语言
<< 返回文章列表

GaussDB OLTP 100 华为数据库的创建脚本和模板

2019年11月25日
盖国强
512

在华为 GaussDB OLTP 100 版本中,和 Oracle 数据库类似,在 scripts 目录提供了一个创建数据库的初始脚本:create_database.sample.sql 。

通过这个脚本可以看到 GaussDB OLTP 数据库的创建过程和关键步骤。在 GaussDB 100中,缺省创建 3 个控制文件,6个 2G 大小的日志文件,用户表空间 5 个 1G 的数据文件。1 个 1G 的 SYSTEM 表空间文件,数据库缺省创建既运行在归档模式下:

create database gauss character set binary 
CONTROLFILE
('/opt/gaussdb/data/data/cntl1',
'/opt/gaussdb/data/data/cntl2',
'/opt/gaussdb/data/data/cntl3')
LOGFILE
('/opt/gaussdb/data/data/log1' size 2G,
'/opt/gaussdb/data/data/log2' size 2G,
'/opt/gaussdb/data/data/log3' size 2G,
'/opt/gaussdb/data/data/log4' size 2G,
'/opt/gaussdb/data/data/log5' size 2G,
'/opt/gaussdb/data/data/log6' size 2G)
system tablespace DATAFILE
'/opt/gaussdb/data/data/system' size 1G
undo tablespace DATAFILE
'/opt/gaussdb/data/data/undo' size 1G
default tablespace DATAFILE
'/opt/gaussdb/data/data/user1' size 1G autoextend ON next 32M,
'/opt/gaussdb/data/data/user2' size 1G autoextend ON next 32M,
'/opt/gaussdb/data/data/user3' size 1G autoextend ON next 32M,
'/opt/gaussdb/data/data/user4' size 1G autoextend ON next 32M,
'/opt/gaussdb/data/data/user5' size 1G autoextend ON next 32M
temporary tablespace TEMPFILE
'/opt/gaussdb/data/data/temp1_01' size 160M autoextend ON next 32M,
'/opt/gaussdb/data/data/temp1_02' size 160M autoextend ON next 32M nologging
tablespace TEMPFILE
'/opt/gaussdb/data/data/temp2_01' size 160M autoextend ON next 32M,
'/opt/gaussdb/data/data/temp2_02' size 160M autoextend ON next 32M nologging
undo tablespace TEMPFILE
'/opt/gaussdb/data/data/temp2_undo' size 1G
ARCHIVELOG;



注意,GaussDB 和 Oracle数据库表空间有一个典型的不同,就是 Undo 表空间被定义为临时文件。