本站文章除注明转载外,均为本站原创: 转载自love wife & love life —Roger的Oracle&MySQL技术博客
随着国产化的声音来越越高;gaussdb 脱颖而出;其中gaussdb分为gauss100/gauss200 两个版本;之前还有个gauss300,据说已经合并到gauss200了。我们首先来学习gauss100吧,这是面向OLTP场景的。
–创建用户
[root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# groupadd roger [root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# useradd -g roger -d /home/roger -m -s /bin/bash roger [root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# passwd roger Changing password for user roger. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: all authentication tokens updated successfully.
–安装目录授权
[root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# [root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# chown -R roger:roger /opt/gauss/ [root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# chmod -R 775 /opt/gauss/
–查看安装程序帮助
[root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# python install.py --help install.py is a utility to install zengine server. Usage: python install.py --help python install.py -U user:group -R installpath -D DATADIR [-O] [-C PARAMETER=VALUE] [-g withoutroot] [-f SQLFILE] python install.py -U user:group -R installpath -D DATADIR [-O] [-C 'PARAMETER=VALUE'] [-g withoutroot] [-f SQLFILE] python install.py -U user:group -R installpath -D DATADIR [-O] [-C "PARAMETER=VALUE"] [-g withoutroot] [-f SQLFILE] Common options: -U the database program and cluster owner -R the database program path -O only install database program, and omit other optional parameters -D location of the database cluster storage area -g run install script without root privilege, but you must have permission of installation folder note: use "-g withoutroot" exactly -C configure the database cluster config, for more detail information see -l specify the zengine install log file path and name, if not, use the default -X sql dialect is enabled by default, specify the option to disable it(not recommended) -P if sysdba login is disabled by configuration, specify this option at the end -f specify a customized create database sql file. if not, use default sql file. --help show this help, then exit If all the optional parameters are not specified, -O option will be used. End check parameters
–安装数据库软件
[root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# python install.py -U roger:roger -R /opt/gauss/gauss100 -D /opt/gauss/gaussdata -O Error: Run package GaussDB_100_1.0.1-RUN-REDHAT-64bit.tar.gz is inconsistent with os system oracle. Please refer to install log "/home/roger/zengineinstall.log" for more detailed information. [root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# [root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# cat /home/roger/zengineinstall.log [2020-02-13 15:55:40] Begin init... [2020-02-13 15:55:40] Installer runs on python version : 2.7.5 [2020-02-13 15:55:40] End init [2020-02-13 15:55:40] Error: Run package GaussDB_100_1.0.1-RUN-REDHAT-64bit.tar.gz is inconsistent with os system oracle. [root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]#
由于软件要去redhat 7.5;而我这里是7.2,因此无法做一致oscheck。所以修改python脚本,跳过检查:
–注释python check内容(注释install.py中的如下两行)
#if self.run_pkg_name.find(distname.upper().replace("OS", "")) == -1: # logExit("Run package %s.tar.gz is inconsistent with os system %s." % (self.run_pkg_name, distname))
–再次install software
[root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# python install.py -U roger:roger -R /opt/gauss/gauss100 -D /opt/gauss/gaussdata -O Checking runner. Checking parameters. End check parameters. Checking user. End check user. Checking old install. End check old install. Checking kernel parameters. Checking directory. Checking integrality of run file... Decompressing run file. Setting user env. Checking data dir and config file Initialize db instance. Changing file permission due to security audit. Install successfully, for more detail information see /home/roger/zengineinstall.log. [root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]#
这里可以深入分析一下安装log,如下:
[root@mysqldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]# cat /home/roger/zengineinstall.log [2020-02-13 15:58:39] Begin init... [2020-02-13 15:58:39] Installer runs on python version : 2.7.5 [2020-02-13 15:58:39] End init [2020-02-13 15:58:39] Using run file as : /opt/gauss/GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/GaussDB_100_1.0.1-RUN-REDHAT-64bit.tar.gz [2020-02-13 15:58:39] Checking runner. [2020-02-13 15:58:39] Check runner user id and group id is : 0, 0 [2020-02-13 15:58:39] End check runner is root [2020-02-13 15:58:39] Checking parameters. [2020-02-13 15:58:39] Using roger:roger to install database [2020-02-13 15:58:39] Using install program path : /opt/gauss/gauss100 [2020-02-13 15:58:39] Using option : program [2020-02-13 15:58:39] Using install data path : /opt/gauss/gaussdata [2020-02-13 15:58:39] Using set config parameters : [] [2020-02-13 15:58:39] End check parameters. [2020-02-13 15:58:39] Checking user. [2020-02-13 15:58:39] Check user cmd: id -g roger | grep -q -w 0 [2020-02-13 15:58:39] Check user cmd: id -gn roger [2020-02-13 15:58:39] End check user. [2020-02-13 15:58:39] Checking old install. [2020-02-13 15:58:39] Using user profile : /home/roger/.bashrc [2020-02-13 15:58:39] End check old install. [2020-02-13 15:58:39] Checking kernel parameters. [2020-02-13 15:58:39] End check kernel parameters [2020-02-13 15:58:39] Checking directory. [2020-02-13 15:58:39] Preparing path [/opt/gauss/gauss100]. [2020-02-13 15:58:39] cmd path chown roger:roger /opt/gauss/gauss100; chmod 700 /opt/gauss/gauss100 [2020-02-13 15:58:39] check [/opt/gauss/gauss100] user permission [2020-02-13 15:58:39] Preparing path [/opt/gauss/gaussdata]. [2020-02-13 15:58:39] cmd path chown roger:roger /opt/gauss/gaussdata; chmod 700 /opt/gauss/gaussdata [2020-02-13 15:58:39] check [/opt/gauss/gaussdata] user permission [2020-02-13 15:58:39] Database program install path available size: 10079M [2020-02-13 15:58:39] End check dir. [2020-02-13 15:58:39] Checking integrality of run file... [2020-02-13 15:58:39] Check integrality of bin file ok [2020-02-13 15:58:39] End check integrality of bin file [2020-02-13 15:58:39] Decompressing run file. [2020-02-13 15:58:39] decompress bin file executable cmd: chmod 700 "/opt/gauss/GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/GaussDB_100_1.0.1-RUN-REDHAT-64bit.tar.gz" [2020-02-13 15:58:39] Decompress cmd: tar -xvf "/opt/gauss/GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/GaussDB_100_1.0.1-RUN-REDHAT-64bit.tar.gz" -C "/opt/gauss/gauss100" && cp -rf /opt/gauss/gauss100/GaussDB_100_1.0.1-RUN-REDHAT-64bit/add-ons /opt/gauss/gauss100/GaussDB_100_1.0.1-RUN-REDHAT-64bit/admin /opt/gauss/gauss100/GaussDB_100_1.0.1-RUN-REDHAT-64bit/bin /opt/gauss/gauss100/GaussDB_100_1.0.1-RUN-REDHAT-64bit/cfg /opt/gauss/gauss100/GaussDB_100_1.0.1-RUN-REDHAT-64bit/lib /opt/gauss/gauss100/GaussDB_100_1.0.1-RUN-REDHAT-64bit/package.xml /opt/gauss/gauss100 && rm -rf /opt/gauss/gauss100/GaussDB_100_1.0.1-RUN-REDHAT-64bit [2020-02-13 15:58:40] /opt/gauss/gauss100/admin/scripts/sql_dialect/ora-dialect.sql file exists in package /opt/gauss/GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/GaussDB_100_1.0.1-RUN-REDHAT-64bit.tar.gz [2020-02-13 15:58:40] Successfully Install zenith application [2020-02-13 15:58:40] Change app permission cmd: chmod 700 /opt/gauss/gauss100 -R&& find '/opt/gauss/gauss100'/add-ons -type f | xargs chmod 500 && find '/opt/gauss/gauss100'/admin -type f | xargs chmod 600 && find '/opt/gauss/gauss100'/lib -type f | xargs chmod 500&& find '/opt/gauss/gauss100'/bin -type f | xargs chmod 500 && chmod 400 '/opt/gauss/gauss100'/package.xml [2020-02-13 15:58:40] Change owner cmd: chown roger:roger -R /opt/gauss/gauss100 [2020-02-13 15:58:40] End decompress bin file. [2020-02-13 15:58:40] Setting user env. [2020-02-13 15:58:40] End set user env. [2020-02-13 15:58:40] Change privilege cmd: chmod 700 /opt/gauss/gaussdata/ -R [2020-02-13 15:58:40] Change owner cmd: chown roger:roger -R "/opt/gauss/gaussdata" [2020-02-13 15:58:40] Initialize db instance. [2020-02-13 15:58:40] config Parameters is empty, so just return. [2020-02-13 15:58:40] Successfully Initialize zenith instance. [2020-02-13 15:58:40] Changing file permission due to security audit. [2020-02-13 15:58:40] Successfully install zenith instance. [2020-02-13 15:58:40] Install successfully, for more detail information see /home/roger/zengineinstall.log. --参数文件 [root@mysqldb cfg]# cat zengine.ini TEMP_BUFFER_SIZE = 1G DATA_BUFFER_SIZE = 1G SHARED_POOL_SIZE = 1G LOG_BUFFER_SIZE = 64M DBWR_PROCESSES = 2 LOG_BUFFER_COUNT = 8 SESSIONS = 1500 INSTANCE_NAME = zenith LSNR_ADDR = 127.0.0.1 LSNR_PORT = 1611 ENABLE_SYSDBA_LOGIN = TRUE [root@mysqldb cfg]# pwd /opt/gauss/gaussdata/cfg
–启动实例
[root@mysqldb cfg]# /opt/gauss/gauss100/bin/zengine nomount -D /opt/gauss/gaussdata /opt/gauss/gauss100/bin/zengine: error while loading shared libraries: libzeprotocol.so: cannot open shared object file: No such file or directory [root@mysqldb cfg]#
配置环境变量:
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:/opt/gauss/gauss100/bin:$HOME/.local/bin:$HOME/bin LD_LIBRARY_PATH=/opt/gauss/gauss100/lib:/opt/gauss/gauss100/add-ons export PATH
–再次启动实例
[roger@mysqldb cfg]$ zengine nomount -D /opt/gauss/gaussdata starting instance(nomount) instance startup failed
查看日志:
[roger@mysqldb run]$ pwd /opt/gauss/gaussdata/log/run [roger@mysqldb run]$ cat zengine.rlog UTC+8 2020-02-13 16:23:29.346|ZENGINE|00000|2770989277335590568|INFO>[LOG] file '/opt/gauss/gaussdata/log/zenith_alarm.log' is added [srv_param.c:518] UTC+8 2020-02-13 16:23:29.346|ZENGINE|00000|71336|INFO>[LOG] file '/opt/gauss/gaussdata/log/run/zengine.rlog' is added [cm_log.c:641] UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] LSNR_ADDR = 127.0.0.1 UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] LSNR_PORT = 1611 UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] DATA_BUFFER_SIZE = 1G UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] SHARED_POOL_SIZE = 1G UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] LOG_BUFFER_SIZE = 64M UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] LOG_BUFFER_COUNT = 8 UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] TEMP_BUFFER_SIZE = 1G UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] SESSIONS = 1500 UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] DBWR_PROCESSES = 2 UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] INSTANCE_NAME = zenith UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] ENABLE_SYSDBA_LOGIN = TRUE UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|INFO>[PARAM] CPU_NODE_BIND = 0 0 UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|206158501544|INFO>starting instance(nomount) UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|140720308557480|ERROR>GS-00001 : Failed to allocate 3518640128 bytes for sga [srv_sga.c:247] UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|ERROR>failed to create sga UTC+8 2020-02-13 16:23:29.348|ZENGINE|00000|71336|ERROR>Instance Startup Failed UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|2770989277335592404|INFO>[LOG] file '/opt/gauss/gaussdata/log/enmotech_alarm.log' is added [srv_param.c:518] UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[LOG] file '/opt/gauss/gaussdata/log/run/zengine.rlog' is added [cm_log.c:641] UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] LSNR_ADDR = 127.0.0.1 UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] LSNR_PORT = 1611 UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] DATA_BUFFER_SIZE = 1G UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] SHARED_POOL_SIZE = 1G UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] LOG_BUFFER_SIZE = 64M UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] LOG_BUFFER_COUNT = 8 UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] TEMP_BUFFER_SIZE = 1G UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] SESSIONS = 1000 UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] DBWR_PROCESSES = 2 UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] INSTANCE_NAME = enmotech UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] ENABLE_SYSDBA_LOGIN = TRUE UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|INFO>[PARAM] CPU_NODE_BIND = 0 0 UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|206158503380|INFO>starting instance(nomount) UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|140728898493908|ERROR>GS-00001 : Failed to allocate 3518640128 bytes for sga [srv_sga.c:247] UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|ERROR>failed to create sga UTC+8 2020-02-13 16:25:46.707|ZENGINE|00000|73172|ERROR>Instance Startup Failed
看上去是内存太大了。 虚拟机环境,改小一点吧:
[roger@mysqldb run]$ cat /opt/gauss/gaussdata/cfg/zengine.ini TEMP_BUFFER_SIZE = 100M DATA_BUFFER_SIZE = 300M SHARED_POOL_SIZE = 100M LOG_BUFFER_SIZE = 64M DBWR_PROCESSES = 2 LOG_BUFFER_COUNT = 8 SESSIONS = 1000 INSTANCE_NAME = enmotech LSNR_ADDR = 127.0.0.1 LSNR_PORT = 1611 ENABLE_SYSDBA_LOGIN = TRUE
–再次启动
[roger@mysqldb run]$ zengine nomount -D /opt/gauss/gaussdata & [1] 76882 [roger@mysqldb run]$ starting instance(nomount) instance started [roger@mysqldb run]$ [roger@mysqldb run]$
截取一小段日志:
UTC+8 2020-02-13 16:29:37.553|ZENGINE|00000|8388361636381010381|INFO>kmc write log module:[WSEC_CBB] filename:[wsecv2_itf.c] nLevel:[0] pszLog:[(UTC) 2020-02-13 08:29:37 WSEC Finalized. ] numline[153] UTC+8 2020-02-13 16:29:37.553|ZENGINE|00000|76237|INFO>SSL disabled: server certificate or private key file is not available. UTC+8 2020-02-13 16:29:37.553|ZENGINE|00000|76237|INFO>instance started UTC+8 2020-02-13 16:29:37.555|ZENGINE|00000|76252|INFO>job master thread started [srv_job.c:638] UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|2770989277335596114|INFO>[LOG] file '/opt/gauss/gaussdata/log/enmotech_alarm.log' is added [srv_param.c:518] UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[LOG] file '/opt/gauss/gaussdata/log/run/zengine.rlog' is added [cm_log.c:641] UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] LSNR_ADDR = 127.0.0.1 UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] LSNR_PORT = 1611 UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] DATA_BUFFER_SIZE = 300M UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] SHARED_POOL_SIZE = 100M UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] LOG_BUFFER_SIZE = 64M UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] LOG_BUFFER_COUNT = 8 UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] TEMP_BUFFER_SIZE = 100M UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] SESSIONS = 1000 UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] DBWR_PROCESSES = 2 UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] INSTANCE_NAME = enmotech UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] ENABLE_SYSDBA_LOGIN = TRUE UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|76882|INFO>[PARAM] CPU_NODE_BIND = 0 0 UTC+8 2020-02-13 16:30:27.180|ZENGINE|00000|206158507090|INFO>starting instance(nomount) UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76900|INFO>rollback thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76895|INFO>dbwr thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76896|INFO>ckpt thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76893|INFO>lgwr thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76897|INFO>smon thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76898|INFO>stats thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76899|INFO>index page recycle thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76902|INFO>rmon thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76894|INFO>dbwr thread started UTC+8 2020-02-13 16:30:27.408|ZENGINE|00000|76901|INFO>rollback thread started UTC+8 2020-02-13 16:30:27.490|ZENGINE|00000|76882|INFO>local ip: 127.0.0.1 UTC+8 2020-02-13 16:30:27.496|ZENGINE|00000|76882|INFO>kmc write log module:[WSEC_CBB] filename:[wsecv2_itf.c] nLevel:[0] pszLog:[(UTC) 2020-02-13 08:30:27 WsecRegFuncEx success ] numline[72]
—手工创建数据库
[roger@mysqldb scripts]$ pwd /opt/gauss/gauss100/admin/scripts [roger@mysqldb scripts]$ ls -ltr total 308 -r-------- 1 roger roger 148517 Feb 13 15:58 initview.sql -r-------- 1 roger roger 38274 Feb 13 15:58 initdb.sql -r-------- 1 roger roger 1024 Feb 13 15:58 create_database.sample.sql -r-------- 1 roger roger 366 Feb 13 15:58 add_standby_log.sample.sql drwx------ 2 roger roger 4096 Feb 13 15:58 upgrade drwx------ 2 roger roger 28 Feb 13 15:58 sql_dialect -r-------- 1 roger roger 2601 Feb 13 15:58 readme.md -r-------- 1 roger roger 9683 Feb 13 15:58 initplsql.sql -r-------- 1 roger roger 90488 Feb 13 15:58 initwsr.sql [roger@mysqldb scripts]$ cat create_database.sample.sql create database gauss character set utf8 CONTROLFILE('?/data/cntl1', '?/data/cntl2', '?/data/cntl3') LOGFILE('?/data/log1' size 2G, '?/data/log2' size 2G, '?/data/log3' size 2G, '?/data/log4' size 2G, '?/data/log5' size 2G, '?/data/log6' size 2G) system tablespace DATAFILE '?/data/system' size 1G undo tablespace DATAFILE '?/data/undo' size 1G default tablespace DATAFILE '?/data/user1' size 1G autoextend on next 32M, '?/data/user2' size 1G autoextend on next 32M, '?/data/user3' size 1G autoextend on next 32M, '?/data/user4' size 1G autoextend on next 32M, '?/data/user5' size 1G autoextend on next 32M temporary tablespace TEMPFILE '?/data/temp1_01' size 160M autoextend on next 32M, '?/data/temp1_02' size 160M autoextend on next 32M nologging tablespace TEMPFILE '?/data/temp2_01' size 160M autoextend on next 32M, '?/data/temp2_02' size 160M autoextend on next 32M nologging undo tablespace TEMPFILE '?/data/temp2_undo' size 1G sysaux tablespace DATAFILE '?/data/sysaux' size 160M autoextend on next 32M ARCHIVELOG; [roger@mysqldb scripts]$
这里我们手工修改一下建库脚本;直接运行命令即可:
SQL> create database roger character set utf8 CONTROLFILE('/opt/gauss/gaussdata/cntl1', '/opt/gauss/gaussdata/cntl2', '/opt/gauss/gaussdata/cntl3') LOGFILE('/opt/gauss/gaussdata/log1' size 2G, '/opt/gauss/gaussdata/log2' size 2G, '/opt/gauss/gaussdata/log3' size 2G, '/opt/gauss/gaussdata/log4' size 2G, '/opt/gauss/gaussdata/log5' size 2G, '/opt/gauss/gaussdata/log6' size 2G) system tablespace DATAFILE '/opt/gauss/gaussdata/system' size 1G undo tablespace DATAFILE '/opt/gauss/gaussdata/undo' size 1G default tablespace DATAFILE '/opt/gauss/gaussdata/user1' size 1G autoextend on next 32M, '/opt/gauss/gaussdata/user2' size 1G autoextend on next 32M, '/opt/gauss/gaussdata/user3' size 1G autoextend on next 32M, '/opt/gauss/gaussdata/user4' size 1G autoextend on next 32M, '/opt/gauss/gaussdata/user5' size 1G autoextend on next 32M temporary tablespace TEMPFILE '/opt/gauss/gaussdata/temp1_01' size 160M autoextend on next 32M, '/opt/gauss/gaussdata/temp1_02' size 160M autoextend on next 32M nologging tablespace TEMPFILE '/opt/gauss/gaussdata/temp2_01' size 160M autoextend on next 32M, '/opt/gauss/gaussdata/temp2_02' size 160M autoextend on next 32M nologging undo tablespace TEMPFILE '/opt/gauss/gaussdata/temp2_undo' size 1G sysaux tablespace DATAFILE '/opt/gauss/gaussdata/sysaux' size 160M autoextend on next 32M ARCHIVELOG; GS-00028, Write size 1982464, expected size 2097152, mostly because file size is larger than disk, please delete the incomplete file GS-00714, Log file size should be larger than log keep size 125845504 SQL>
空间不足了。导致建库报错。
SQL> create database roger character set utf8 CONTROLFILE('/opt/gauss/gaussdata/cntl1', '/opt/gauss/gaussdata/cntl2', '/opt/gauss/gaussdata/cntl3') LOGFILE('/opt/gauss/gaussdata/log1' size 128m, '/opt/gauss/gaussdata/log2' size 128m, '/opt/gauss/gaussdata/log3' size 128m, '/opt/gauss/gaussdata/log4' size 128m, '/opt/gauss/gaussdata/log5' size 128m, '/opt/gauss/gaussdata/log6' size 128m) system tablespace DATAFILE '/opt/gauss/gaussdata/system' size 512m undo tablespace DATAFILE '/opt/gauss/gaussdata/undo' size 1G default tablespace DATAFILE '/opt/gauss/gaussdata/user1' size 1G autoextend on next 32M, '/opt/gauss/gaussdata/user2' size 1G autoextend on next 32M, '/opt/gauss/gaussdata/user3' size 1G autoextend on next 32M, '/opt/gauss/gaussdata/user4' size 1G autoextend on next 32M, '/opt/gauss/gaussdata/user5' size 100m autoextend on next 32M temporary tablespace TEMPFILE '/opt/gauss/gaussdata/temp1_01' size 160M autoextend on next 32M, '/opt/gauss/gaussdata/temp1_02' size 160M autoextend on next 32M nologging tablespace TEMPFILE '/opt/gauss/gaussdata/temp2_01' size 160M autoextend on next 32M, '/opt/gauss/gaussdata/temp2_02' size 160M autoextend on next 32M nologging undo tablespace TEMPFILE '/opt/gauss/gaussdata/temp2_undo' size 200m sysaux tablespace DATAFILE '/opt/gauss/gaussdata/sysaux' size 160M autoextend on next 32M ARCHIVELOG; Succeed. SQL> col name for a10 SQL> col log_mdoe for a10 SQL> col database_role for a10 SQL> select dbid,name,status,open_status,current_scn,lsn,log_mode,database_role from v$database; DBID NAME STATUS OPEN_STATUS CURRENT_SCN LSN LOG_MODE DATABASE_R ------------ ---------- -------------------- -------------------- -------------------- -------------------- ------------------------------ ---------- 773766796 ROGER OPEN READ WRITE 657147432961 45316 ARCHIVELOG PRIMARY 1 rows fetched. SQL> col file_name for a45 SQL> set lines 200 SQL> select TABLESPACE_ID,ID,FILE_NAME,HIGH_WATER_MARK from v$datafile order by 2; TABLESPACE_ID ID FILE_NAME HIGH_WATER_MARK ------------- ------------ --------------------------------------------- --------------- 0 0 /opt/gauss/gaussdata/system 1682 1 1 /opt/gauss/gaussdata/temp1_01 2 1 2 /opt/gauss/gaussdata/temp1_02 1 2 3 /opt/gauss/gaussdata/undo 53794 3 4 /opt/gauss/gaussdata/user1 2 3 5 /opt/gauss/gaussdata/user2 1 3 6 /opt/gauss/gaussdata/user3 1 3 7 /opt/gauss/gaussdata/user4 1 3 8 /opt/gauss/gaussdata/user5 1 4 9 /opt/gauss/gaussdata/temp2_01 2 4 10 /opt/gauss/gaussdata/temp2_02 1 5 11 /opt/gauss/gaussdata/temp2_undo 2 6 12 /opt/gauss/gaussdata/sysaux 8302 13 rows fetched.
—初始化相关数据字典
[root@mysqldb scripts]# pwd /opt/gauss/gauss100/admin/scripts [root@mysqldb scripts]# [root@mysqldb scripts]# ls -ltr total 308 -r-------- 1 roger roger 148517 Feb 13 15:58 initview.sql -r-------- 1 roger roger 38274 Feb 13 15:58 initdb.sql -r-------- 1 roger roger 1024 Feb 13 15:58 create_database.sample.sql -r-------- 1 roger roger 366 Feb 13 15:58 add_standby_log.sample.sql drwx------ 2 roger roger 4096 Feb 13 15:58 upgrade drwx------ 2 roger roger 28 Feb 13 15:58 sql_dialect -r-------- 1 roger roger 2601 Feb 13 15:58 readme.md -r-------- 1 roger roger 9683 Feb 13 15:58 initplsql.sql -r-------- 1 roger roger 90488 Feb 13 15:58 initwsr.sql
需要执行上述部分脚本:initwsr.sql initplsql.sql initview.sql initdb.sql ./sql_dialect/sql_oradict.sql
–手工收集快照
SQL> exec WSR$CREATE_SESSION_SNAPSHOT(); PL/SQL procedure successfully completed.
接下来开启快乐的国产数据库学习之路吧~!