当我们遇到图形化界面不能时候的情况下,只能使用手工(命令行)的方式创建了
1、删除原有的数据库
停止监听,启动到exclusive状态
2、修改cluster_database参数
需要将cluster_database=改为FALSE,否则exclusive模式不生效
SQL> alter system set cluster_database=FALSE scope=spfile sid='*';
System altered.
SQL> startup force mount EXCLUSIVE
ORACLE instance started.
Total System Global Area 4.2758E+10 bytes
Fixed Size 2262656 bytes
Variable Size 6174017920 bytes
Database Buffers 3.6507E+10 bytes
Redo Buffers 74420224 bytes
Database mounted.
3、开启受限制会话
开启受限制的会话,否则不能删除报错
SQL> drop database ;
drop database
*
ERROR at line 1:
ORA-12719: operation requires database is in RESTRICTED mode
SQL> alter system enable RESTRICTED session;
4、删除数据库
drop database;
后台日志显示
5、创建pfile文件
创建数据库也需要在EXCLUSIVE模式,需要将数据库已单机的方式先创建,否则会报错
chx.ora
*.db_name='jxswj2js'
*.db_block_size=8192
*.db_create_file_dest='+DATAC3'
*.control_files='+DATAC3/jxswj2js/controlfile/control01.ctl','+DATAC3/jxswj2js/controlfile/control02.ctl'
*.sga_target=54G
*.pga_aggregate_target=14G
*.cluster_database=FALSE
*.compatible='11.2.0.2'
6、手工创建数据库(命令行)
创建数据库
SQL> startup force pfile=chx.ora nomount EXCLUSIVE
create database jxswj2js character set al32utf8 extent management local;
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
alter user sys identified by "servyou_0571#";
alter user system identified by "servyou_0571#";
Conn system/"servyou_0571#"
@?/sqlplus/admin/pupbld.sql
7、创建undo表空间和redo文件
create undo tablespace undotbs1 datafile '+DATAC3' SIZE 10G AUTOEXTEND ON;
create undo tablespace undotbs2 datafile '+DATAC3' SIZE 10G AUTOEXTEND ON;
create tablespace users datafile '+DATAC3' SIZE 10G AUTOEXTEND ON;
Alter database default tablespace users;
alter database add logfile thread 1 group 3 (‘+DATAC3/ jxswj2js/onlinelog/group3a’) size 500m;
alter database add logfile thread 1 group 4 (‘+DATAC3/ jxswj2js/onlinelog/group4a’) size 500m;
alter database add logfile thread 2 group 5 (‘+DATAC3/ jxswj2js/onlinelog/group5a’) size 500m;
alter database add logfile thread 2 group 6 (‘+DATAC3/ jxswj2js/onlinelog/group6a’) size 500m;
alter database add logfile thread 2 group 7 (‘+DATAC3/ jxswj2js/onlinelog/group7a’) size 500m;
alter database add logfile thread 2 group 8 (‘+DATAC3/ jxswj2js/onlinelog/group8a’) size 500m;
8、创建spfile
create spfile='+DATAC3/jxswj2js/spfilejxswj2js.ora' from pfile='/home/oracle/chx.ora';
9、单机改为rac集群
SQL> alter system set cluster_database=TRUE scope=spfile;
SQL> alter system set cluster_database_instances=2 scope=spfile;
SQL> alter system set undo_tablespace='UNDOTBS1';
alter system set thread=1 scope=spfile;
SQL> alter database enable thread 2;
10、创建集群pfile
jxswj2js1.__db_cache_size=52747567104 jxswj2js2.__db_cache_size=52747567104 jxswj2js1.__java_pool_size=536870912 jxswj2js2.__java_pool_size=536870912 jxswj2js1.__large_pool_size=134217728 jxswj2js2.__large_pool_size=134217728 jxswj2js1.__pga_aggregate_target=15032385536 jxswj2js2.__pga_aggregate_target=15032385536 jxswj2js1.__sga_target=57982058496 jxswj2js2.__sga_target=57982058496 jxswj2js1.__shared_io_pool_size=0 jxswj2js2.__shared_io_pool_size=0 jxswj2js1.__shared_pool_size=4294967296 jxswj2js2.__shared_pool_size=4294967296 jxswj2js1.__streams_pool_size=0 jxswj2js2.__streams_pool_size=0 *.cluster_database=TRUE *.cluster_database_instances=2 *.compatible='11.2.0.2' *.control_files='+DATAC3/jxswj2js/controlfile/control01.ctl','+DATAC3/jxswj2js/controlfile/control02.ctl' *.db_block_size=8192 *.db_create_file_dest='+DATAC3' *.db_name='jxswj2js' *.pga_aggregate_target=14G *.sga_target=54G jxswj2js1.instance_number=1 jxswj2js2.instance_number=2 jxswj2js1.thread=1 jxswj2js2.thread=2 jxswj2js1.undo_tablespace='UNDOTBS1' jxswj2js2.undo_tablespace='UNDOTBS2'
11、添加数据库到集群
[oracle@jxdsadm01vm03 ~]$ /u01/app/11.2.0.4/grid/bin/srvctl add db -d jxswj2js -o /u01/app/oracle/product/11.2.0.4/dbhome_1
[oracle@jxdsadm01vm03 ~]$ /u01/app/11.2.0.4/grid/bin/srvctl add instance -d jxswj2js -i jxswj2js1 -n jxdsadm01vm03
[oracle@jxdsadm01vm03 ~]$ /u01/app/11.2.0.4/grid/bin/srvctl add instance -d jxswj2js -i jxswj2js2 -n jxdsadm02vm03
/u01/app/11.2.0.4/grid/bin/srvctl start db -d jxswj2js
12、配置scan监听
[grid@jxdsadm01vm03 ~]$ srvctl config scan
SCAN name: jxds-scan3, Network: 1/146.12.72.0/255.255.255.0/bondeth0
SCAN VIP name: scan1, IP: /jxds-scan3/146.12.72.124
SCAN VIP name: scan2, IP: /jxds-scan3/146.12.72.123
SCAN VIP name: scan3, IP: /jxds-scan3/146.12.72.125
SQL> alter system set remote_listener='jxds-scan3:1521' scope=both sid='*';