sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 产品DBA > Oracle RAC >

【学习笔记】Oracle RAC环境中使用手动创建数据库实例

时间:2016-10-21 09:02   来源:Oracle研究中心   作者:HTZ   点击:

天萃荷净 11g rac环境中手动创建数据库,关于11g rac环境中怎么手动创建数据库,下面是在sfrac环境中测试,如果使用asm的情况下,还会更好处理一些,因为路径都不需要指定。

测试环境:os:rhel 5.8 db:11.2.0.3.7(gi) sfrac:5.1

1,配置sid


[oracle@rac41 ~]$ echo $ORACLE_SID
rac31

2.创建密码文件


[oracle@rac41 ~]$ orapwd file=$ORACLE_HOME/dbs/orapwrac31 password=oracle force=y
[oracle@rac41 ~]$ ls -l $ORACLE_HOME/dbs/orapwrac31
-rw-r----- 1 oracle oinstall 1536 Sep 17 03:55 /u01/app/oracle/product/11.2.0/db_1/dbs/orapwrac31

3,创建adump文件,diag下面的目录会自动创建的


[oracle@rac41 ~]$ mkdir -p $ORACLE_BASE/admin/rac3/adump

4,创建参数文件


[oracle@rac41 ~]$ cat $ORACLE_HOME/dbs/initrac31.ora
*.audit_file_dest='/u01/app/oracle/admin/rac3/adump'
*.audit_trail='NONE'
#*.cluster_database=true
*.compatible='11.2.0.3.0'
*.control_files='/oradata/rac3/control01.ctl','/oradata/rac3/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='rac3'
*.db_recovery_file_dest='/oradata'
*.db_recovery_file_dest_size=4558159
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=rac3XDB)'
rac31.instance_number=1
rac32.instance_number=2
*.open_cursors=300
*.pga_aggregate_target=131072000
*.processes=150
*.remote_listener='rac4-scan:1521'
*.remote_login_passwordfile='exclusive'
*.sga_target=393216000
rac32.thread=2
rac31.thread=1
rac31.undo_tablespace='UNDOTBS1'
rac32.undo_tablespace='UNDOTBS2'

4,create database创建数据库


SQL> startup nomount
ORACLE instance started.

Total System Global Area  392495104 bytes
Fixed Size                  2228704 bytes
Variable Size             125832736 bytes
Database Buffers          260046848 bytes
Redo Buffers                4386816 bytes
SQL> CREATE DATABASE rac3
  2     USER SYS IDENTIFIED BY oracle
  3     USER SYSTEM IDENTIFIED BY oracle
  4     LOGFILE GROUP 1 ('/oradata/rac3/redo01a.log') SIZE 100M BLOCKSIZE 512,
  5             GROUP 2 ('/oradata/rac3/redo02a.log') SIZE 100M BLOCKSIZE 512,
  6             GROUP 3 ('/oradata/rac3/redo03a.log') SIZE 100M BLOCKSIZE 512
  7     MAXLOGFILES 15
  8     MAXLOGMEMBERS 4
  9     MAXLOGHISTORY 1
10     MAXDATAFILES 1000
11     CHARACTER SET ZHS16GBK
12     NATIONAL CHARACTER SET AL16UTF16
13     EXTENT MANAGEMENT LOCAL
14     DATAFILE '/oradata/rac3/system01.dbf' SIZE 325M REUSE
15     SYSAUX DATAFILE '/oradata/rac3/sysaux01.dbf' SIZE 325M REUSE
16     DEFAULT TABLESPACE users
17        DATAFILE '/oradata/rac3/users01.dbf'
18        SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
19     DEFAULT TEMPORARY TABLESPACE tempts1
20        TEMPFILE '/oradata/rac3/temp01.dbf'
21        SIZE 20M REUSE
22     UNDO TABLESPACE undotbs1
23        DATAFILE '/oradata/rac3/undotbs01.dbf'
24        SIZE 200M REUSE AUTOEXTEND OFF;

Database created.

运行下面的脚本
@ /rdbms/admin/catalog.sql
@ /rdbms/admin/catproc.sql
@ /sqlplus/admin/pupbld.sql
@ /rdbms/admin/catclust.sql

5,增加节点2的信息


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
修改下面的参数
*.cluster_database=true
SQL> startup
ORACLE instance started.

Total System Global Area  392495104 bytes
Fixed Size                  2228704 bytes
Variable Size             184552992 bytes
Database Buffers          201326592 bytes
Redo Buffers                4386816 bytes
Database mounted.
Database opened.

SQL> alter database add logfile thread 2 group 4 ('/oradata/rac3/redo04.dbf') size 100M, group 5 ('/oradata/rac3/redo05.dbf') size 100M,group 6 ('/oradata/rac3/redo06.dbf') size 100M;
Database altered.
SQL> alter database enable public thread 2;
Database altered.
SQL> CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '/oradata/rac3/undotbs02.dbf' SIZE 200M autoextend on;
TablesOracleоpace created.

[oracle@rac42 ~]$ mkdir -p $ORACLE_BASE/admin/rac3/adump
[oracle@rac42 ~]$ orapwd file=$ORACLE_HOME/dbs/orapwrac31 password=oracle force=y

6,创建spfile文件


SQL> create spfile='/oradata/rac3/spfilerac3.ora' from pfile;

File created.

7,gi中增加db/instance资源


[oracle@rac41 ~]$ srvctl add database -d rac3 -o $ORACLE_HOME -p /oradata/rac3/spfilerac3.ora -s open -t immediate -n rac3 -y manual
[oracle@rac41 ~]$ srvctl add instance -d rac3 -i rac31 -n rac41
[oracle@rac41 ~]$ srvctl add instance -d rac3 -i rac32 -n rac42

8,启动数据库


[oracle@rac41 ~]$ srvctl start instance -d rac3 -i rac31
[oracle@rac41 ~]$ srvctl start instance -d rac3 -i rac32
[oracle@rac41 ~]$ srvctl status instance -d rac3 -i rac32
Instance rac32 is running on node rac42
[oracle@rac41 ~]$ srvctl status instance -d rac3 -i rac31
Instance rac31 is running on node rac41

9,查看资源状态


[grid@rac41 ~]$ crsctl stat resource -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac41                                       
               ONLINE  ONLINE       rac42                                       
ora.gsd
               OFFLINE OFFLINE      rac41                                       
               OFFLINE OFFLINE      rac42                                       
ora.net1.network
               ONLINE  ONLINE       rac41                                       
               ONLINE  ONLINE       rac42                                       
ora.ons
               ONLINE  ONLINE       rac41                                       
               ONLINE  ONLINE       rac42                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac41                                       
ora.cvu
      1        ONLINE  ONLINE       rac41                                       
ora.oc4j
      1        OFFLINE OFFLINE                                                  
ora.rac3.db
      1        ONLINE  ONLINE       rac41                    Open               
      2        ONLINE  ONLINE       rac42                    Open               
ora.rac41.vip
      1        ONLINE  ONLINE       rac41                                       
ora.rac42.vip
      1        ONLINE  ONLINE       rac42                                       
ora.scan1.vip
      1        ONLINE  ONLINE       rac41


本文固定链接: http://www.htz.pw/2013/09/16/11g-rac%e7%8e%af%e5%a2%83%e4%b8%ad%e6%89%8b%e5%8a%a8%e5%88%9b%e5%bb%ba%e6%95%b0%e6%8d%ae%e5%ba%93.html | 认真就输

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【学习笔记】Oracle RAC环境中使用手动创建数据库实例

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/1021.html

Oracle研究中心

关键词:

RAC中手动创建数据库实例案例

Oracle RAC手动安装实例