Oracle Study之案例--Oracle 11g RAC环境下手工建库

简介:

Oracle Study之案例--Oracle 11g RAC手工建库案例


  在一些特殊情况下无法用DBCA建库,可以考虑在RAC 环境下通过手工方式建库,步骤和单实例基本一致,只是其中有些需要注意的地方。

环境:

操作系统:    RedHat EL5

集群软件:    CRS 10.2.0.1

数据库软件:  Oracle 10.2.0.1


RAC 手工建库:test


一、在rac1 建立口令文件

[oracle@rac1 dbs]$ orapwd file=orapwtest1 password=oracle entries=3 force=y

二、建立pfile 文件

--利用已有的库(prod),来建立

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[oracle@rac1 dbs]$sqlplus  '/as sysdba'
SQL*Plus: Release  10.2. 0.1. 0  - Production  on  Mon Sep  26  20 : 01 : 36  2011
Copyright (c)  1982 2005 , Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release  10.2. 0.1. 0  - Production
With the Partitioning, Real Application Clusters, OLAP  and  Data Mining options
 
SQL> show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/ 10.2. 0
                                                  /db_1/dbs/spfileprod1.ora
                                                  
SQL> create pfile= '/home/oracle/prod1.ora'  from  spfile;
File created.

[oracle@rac1 ~]$ cp prod1.ora $ORACLE_HOME/dbs/inittest1.ora

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
修改inittest1.ora后, 如下:
[oracle@rac1 dbs]$ cat inittest1.ora 
test1.__db_cache_size= 46137344
test1.__java_pool_size= 4194304
test1.__large_pool_size= 4194304
test1.__shared_pool_size= 134217728
test1.__streams_pool_size= 0
*.audit_file_dest= '/u01/app/oracle/admin/test/adump'
*.background_dump_dest= '/u01/app/oracle/admin/test/bdump'
*.cluster_database= false
*.compatible= '10.2.0.1.0'
*.control_files= '+DG1/test/controlfile/control01.ctl' , '+RECOVER/test/controlfile/control02.ctl'
*.core_dump_dest= '/u01/app/oracle/admin/test/cdump'
*.db_block_size= 8192
*.db_create_file_dest= '+DG1'
*.db_domain= ''
*.db_file_multiblock_read_count= 16
*.db_name= 'test'
*.db_recovery_file_dest= '+RECOVER'
*.db_recovery_file_dest_size= 2147483648
*.dispatchers= '(PROTOCOL=TCP) (SERVICE=testXDB)'
test1.instance_number= 1
*.job_queue_processes= 10
test1.log_archive_dest_1= 'location=/u01/arch'
*.log_archive_format= 'arch_%t_%s_%r.log'
*.open_cursors= 300
*.pga_aggregate_target= 60817408
*.processes= 150
*.remote_listener= 'LISTENERS_PROD'
*.remote_login_passwordfile= 'exclusive'
*.sga_max_size= 210763776
*.sga_target= 189792256
test1.thread= 1
*.undo_management= 'AUTO'
test1.undo_tablespace= 'UNDOTBS1'
*.user_dump_dest= '/u01/app/oracle/admin/test/udump'

创建相关目录:

1
2
3
4
[oracle@rac1 dbs]$mkdir -p  /u01/app/oracle/admin/test/cdump
[oracle@rac1 dbs]$mkdir -p  /u01/app/oracle/admin/test/bdump
[oracle@rac1 dbs]$mkdir -p  /u01/app/oracle/admin/test/udump
[oracle@rac1 dbs]$mkdir -p  /u01/app/oracle/admin/test/adump

三、instane 启动到nomount ,建库

-------------将instance启动到nomount 状态建库,建库脚本如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
CREATE DATABASE test
controlfile reuse
LOGFILE GROUP  1  ( '+DG1/TEST/ONLINELOG/redo01a.log' ) SIZE 10M REUSE,
GROUP  2  ( '+DG1/TEST/ONLINELOG/redo02a.log' ) SIZE 10M REUSE
MAXLOGFILES  5
MAXLOGMEMBERS  5
MAXLOGHISTORY  1
MAXDATAFILES  100
MAXINSTANCES  1
CHARACTER SET zhs16gbk
NATIONAL CHARACTER SET AL16UTF16
DATAFILE  '+DG1/TEST/DATAFILE/system01.dbf'  SIZE 325M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
SYSAUX DATAFILE  '+DG1/TEST/DATAFILE/sysaux01.dbf'  SIZE 100M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
UNDO TABLESPACE undotbs1
DATAFILE  '+DG1/TEST/DATAFILE/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

建库日志如下:

[oracle@rac1 ~]$ tail -f /u01/app/oracle/admin/test/bdump/alert_test1.log

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
CREATE DATABASE test
controlfile reuse
LOGFILE GROUP  1  ( '+DG1/TEST/ONLINELOG/redo01a.log' ) SIZE 10M REUSE,
GROUP  2  ( '+DG1/TEST/ONLINELOG/redo02a.log' ) SIZE 10M REUSE
MAXLOGFILES  5
MAXLOGMEMBERS  5
MAXLOGHISTORY  1
MAXDATAFILES  100
MAXINSTANCES  1
CHARACTER SET zhs16gbk
NATIONAL CHARACTER SET AL16UTF16
DATAFILE  '+DG1/TEST/DATAFILE/system01.dbf'  SIZE 325M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
SYSAUX DATAFILE  '+DG1/TEST/DATAFILE/sysaux01.dbf'  SIZE 100M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
UNDO TABLESPACE undotbs1
DATAFILE  '+DG1/TEST/DATAFILE/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
Mon Sep  26  20 : 15 : 19  2011
WARNING: Default Temporary Tablespace  not  specified  in  CREATE DATABASE command
Default Temporary Tablespace will be necessary  for  a locally managed database  in  future release
Starting background process ASMB
ASMB started  with  pid= 19 , OS id= 27922
Starting background process RBAL
RBAL started  with  pid= 20 , OS id= 27926
Mon Sep  26  20 : 15 : 23  2011
SUCCESS: diskgroup DG1 was mounted
SUCCESS: diskgroup DG1 was dismounted
SUCCESS: diskgroup RECOVER was mounted
SUCCESS: diskgroup RECOVER was dismounted
Mon Sep  26  20 : 15 : 23  2011
SUCCESS: diskgroup DG1 was mounted
SUCCESS: diskgroup RECOVER was mounted
Mon Sep  26  20 : 15 : 23  2011
Database mounted  in  Exclusive Mode
Mon Sep  26  20 : 15 : 23  2011
Successful mount of redo thread  1 with  mount id  2060991191
Assigning activation ID  2060991191  ( 0x7ad83ad7 )
Thread  1  opened  at  log sequence  1
   Current log#  1  seq#  1  mem#  0 : +DG1/test/onlinelog/redo01a.log
Successful open of redo thread  1
Mon Sep  26  20 : 15 : 24  2011
MTTR advisory is disabled because FAST_START_MTTR_TARGET is  not  set
Mon Sep  26  20 : 15 : 24  2011
SMON: enabling cache recovery
Mon Sep  26  20 : 15 : 24  2011
create tablespace SYSTEM datafile   '+DG1/TEST/DATAFILE/system01.dbf'  SIZE 325M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
   default storage (initial 10K next 10K) EXTENT MANAGEMENT DICTIONARY online
Mon Sep  26  20 : 15 : 29  2011
Completed: create tablespace SYSTEM datafile   '+DG1/TEST/DATAFILE/system01.dbf'  SIZE 325M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
   default storage (initial 10K next 10K) EXTENT MANAGEMENT DICTIONARY online
Mon Sep  26  20 : 15 : 29  2011
create rollback segment SYSTEM tablespace SYSTEM
   storage (initial 50K next 50K)
Completed: create rollback segment SYSTEM tablespace SYSTEM
   storage (initial 50K next 50K)
Mon Sep  26  20 : 15 : 36  2011
Thread  1  advanced to log sequence  2
   Current log#  2  seq#  2  mem#  0 : +DG1/test/onlinelog/redo02a.log
Mon Sep  26  20 : 15 : 36  2011
CREATE UNDO TABLESPACE UNDOTBS1 DATAFILE   '+DG1/TEST/DATAFILE/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
Mon Sep  26  20 : 15 : 41  2011
Successfully onlined Undo Tablespace  1.
Completed: CREATE UNDO TABLESPACE UNDOTBS1 DATAFILE   '+DG1/TEST/DATAFILE/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
Mon Sep  26  20 : 15 : 41  2011
create tablespace SYSAUX datafile   '+DG1/TEST/DATAFILE/sysaux01.dbf'  SIZE 100M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
   EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO online
Completed: create tablespace SYSAUX datafile   '+DG1/TEST/DATAFILE/sysaux01.dbf'  SIZE 100M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
   EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO online
Mon Sep  26  20 : 15 : 44  2011
ALTER DATABASE DEFAULT TABLESPACE SYSTEM 
Completed: ALTER DATABASE DEFAULT TABLESPACE SYSTEM 
Mon Sep  26  20 : 15 : 47  2011
SMON: enabling tx recovery
Mon Sep  26  20 : 15 : 48  2011
Threshold validation cannot be done  before  catproc is loaded.
Threshold validation cannot be done  before  catproc is loaded.
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started  with  pid= 23 , OS id= 28488
Mon Sep  26  20 : 15 : 49  2011
Completed: CREATE DATABASE test
controlfile reuse
LOGFILE GROUP  1  ( '+DG1/TEST/ONLINELOG/redo01a.log' ) SIZE 10M REUSE,
GROUP  2  ( '+DG1/TEST/ONLINELOG/redo02a.log' ) SIZE 10M REUSE
MAXLOGFILES  5
MAXLOGMEMBERS  5
MAXLOGHISTORY  1
MAXDATAFILES  100
MAXINSTANCES  1
CHARACTER SET zhs16gbk
NATIONAL CHARACTER SET AL16UTF16
DATAFILE  '+DG1/TEST/DATAFILE/system01.dbf'  SIZE 325M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
SYSAUX DATAFILE  '+DG1/TEST/DATAFILE/sysaux01.dbf'  SIZE 100M AUTOEXTEND ON NEXT 20M MAXSIZE UNLIMITED
UNDO TABLESPACE undotbs1
DATAFILE  '+DG1/TEST/DATAFILE/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
Mon Sep  26  20 : 15 : 49  2011
db_recovery_file_dest_size of  2048  MB is  0.00 % used. This is a
user-specified limit  on  the amount of space that will be used by  this
database  for  recovery-related files,  and  does  not  reflect the amount of
space available  in  the underlying filesystem  or  ASM diskgroup.

四、添加tablespace

------------建库完毕查看,建立其余表空间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SQL> select name  from  v$datafile;
NAME
--------------------------------------------------------------------------------
+DG1/test/datafile/system01.dbf
+DG1/test/datafile/undotbs01.dbf
+DG1/test/datafile/sysaux01.dbf
SQL> select name  from  v$tempfile;
no rows selected
 
SQL> create temporary tablespace temp
   2    tempfile  '+DG1' ;
Tablespace created.
 
SQL> select name  from  v$tempfile;
NAME
--------------------------------------------------------------------------------
+DG1/test/tempfile/temp .281.762898635
 
SQL> create tablespace users
   2    datafile  '+DG1' ;
Tablespace created.
 
SQL>  select name  from  v$datafile;
NAME
--------------------------------------------------------------------------------
+DG1/test/datafile/system01.dbf
+DG1/test/datafile/undotbs01.dbf
+DG1/test/datafile/sysaux01.dbf
+DG1/test/datafile/users .282.762898685
 
SQL> ALTER database default tablespace users;
Database altered.
 
SQL> alter database default temporary tablespace temp;
Database altered.
SQL> 
SQL> create undo tablespace undotbs2 
   2    datafile  '+DG1'  size 100m reuse 
   3    autoextend  on  maxsize unlimited
   4     extent management local;

五、建立数据字典

Tablespace created.

--运行以下数据字典的脚本

[oracle@rac1 dbs]$more  cr_dict.sql

1
2
3
4
5
6
7
8
9
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/catexp.sql 
@?/rdbms/admin/catexp7.sql 
@?/rdbms/admin/catoctk.sql
@?/rdbms/admin/owminst.plb 
@?/rdbms/admin/catclust.sql
@?/rdbms/admin/utlrp.sql

六、创建spfile

---创建spfile

1
2
3
4
5
6
7
8
9
10
11
SQL> show parameter spfile;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string
SQL> create spfile= '+DG1/test/spfile/spfileprod.ora'  from  pfile;
create spfile= '+DG1/test/spfile/spfileprod.ora'  from  pfile
*
ERROR  at  line  1 :
ORA -01078 : failure  in  processing system parameters
ORA -17502 : ksfdcre: 4  Failed to create file +DG1/test/spfile/spfileprod.ora
ORA -15173 : entry  'spfile'  does  not  exist  in  directory  'test'

---首先在ASM下建立相关的目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
[oracle@rac1 dbs]$ export ORACLE_SID=+ASM1
[oracle@rac1 dbs]$ asmcmd
ASMCMD> ls
DG1/
RECOVER/
ASMCMD> cd DG1
ASMCMD> ls
PROD/
TEST/
ASMCMD> cd TEST
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
TEMPFILE/
ASMCMD> help
         asmcmd [-p] [command]
         The environment variables ORACLE_HOME  and  ORACLE_SID determine the 
         instance to which the program connects,  and  ASMCMD establishes a 
         bequeath connection to it,  in  the same manner  as  a SQLPLUS / AS 
         SYSDBA.  The user must be a member of the SYSDBA group.
         Specifying the -p option allows the current directory to be displayed 
         in  the command prompt, like so:
         ASMCMD [+DATAFILE/ORCL/CONTROLFILE] >
         [command] specifies one of the following commands, along  with  its
         parameters.
         Type  "help [command]"  to get help  on  a specific ASMCMD command.
         commands:
         --------
         cd
         du
         find
         help
         ls
         lsct
         lsdg
         mkalias
         mkdir
         pwd
         rm
         rmalias
ASMCMD> mkdir SPFILE
 
[oracle@rac1 dbs]$ export ORACLE_SID=test1
[oracle@rac1 dbs]$ sqlplus  '/as sysdba'
SQL*Plus: Release  10.2. 0.1. 0  - Production  on  Mon Sep  26  20 : 39 : 53  2011
Copyright (c)  1982 2005 , Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release  10.2. 0.1. 0  - Production
With the Partitioning, Real Application Clusters, OLAP  and  Data Mining options
 
SQL> create spfile= '+DG1/TEST/SPFILE/spfiletest.ora'  from  pfile;
File created.
SQL> startup force
ORACLE instance started.
Total System Global Area   213909504  bytes
Fixed Size                   1218604  bytes
Variable Size              163579860  bytes
Database Buffers            46137344  bytes
Redo Buffers                 2973696  bytes
Database mounted.

---修改pfile 连接到spfile

[oracle@rac1 dbs]$ vi inittest1.ora

1
2
3
4
5
*.cluster_database=FALSE
test1.log_archive_dest_1= 'location=/u01/arch'
*.log_archive_format= 'arch_%t_%s_%r.log'
*.SPFILE= '+DG1/test/spfile/spfiletest.ora'
~

1
2
3
4
5
6
7
8
9
10
11
12
13
SQL> startup force
ORACLE instance started.
Total System Global Area   213909504  bytes
Fixed Size                   1218604  bytes
Variable Size              163579860  bytes
Database Buffers            46137344  bytes
Redo Buffers                 2973696  bytes
Database mounted.
Database opened.
SQL> show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DG1/test/spfile/spfiletest.ora

七、修改相应的rac参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
SQL> show parameter cluster
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean     FALSE
cluster_database_instances           integer      1
cluster_interconnects                string
 
SQL> alter system set cluster_database= true  scope=spfile;
System altered.
 
SQL> alter system set cluster_database_instances= 2  scope=spfile;
System altered.
 
SQL> startup force;
ORACLE instance started.                                                                                                                 
Total System Global Area   213909504  bytes
Fixed Size                   1218604  bytes
Variable Size              163579860  bytes
Database Buffers            46137344  bytes
Redo Buffers                 2973696  bytes
Database mounted.
Database opened.
 
---添加redo 日志给instance  2
SQL> alter database add logfile thread  2 
   2     group  4  ( '+DG1/test/onlinelog/redo04a.log' ) size 10m;
Database altered.
 
SQL> alter database add logfile thread  2 
   2     group  5  ( '+DG1/test/onlinelog/redo05a.log' ) size 10m;
Database altered.
 
SQL> alter system set undo_tablespace=undotbs2 sid= 'test2' ;
System altered.
 
SQL> alter system set thread= 2  sid= 'test2' ;
System altered.

八、在第二个节点上,启动instance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
1 )创建口令文件
[oracle@rac2 dbs]$ orapwd file=orapwtest2 password=oracle entries= 3  force=y
SQL> 
SQL> startup
ORA -29760 : instance_number parameter  not  specified
 
---启动instance 失败
2 )在节点 1  上,添加如下信息
SQL> alter system set instance_number= 1  scope=spfile sid= 'test1' ;
System altered.
SQL> alter system set instance_number= 2  scope=spfile sid= 'test2' ;
System altered.
 
3 )节点 2  redo不可用
----节点 2  ,instance  2 启动失败
SQL> startup force
ORACLE instance started.
Total System Global Area   213909504  bytes
Fixed Size                   1218604  bytes
Variable Size              109053908  bytes
Database Buffers           100663296  bytes
Redo Buffers                 2973696  bytes
ORA -01618 : redo thread  2  is  not  enabled - cannot mount
 
---在节点 1  ,如下操作
SQL> startup force
ORACLE instance started.
Total System Global Area   213909504  bytes
Fixed Size                   1218604  bytes
Variable Size              163579860  bytes
Database Buffers            46137344  bytes
Redo Buffers                 2973696  bytes
Database mounted.
Database opened.
 
SQL> select *  from  v$log;
     GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
          1           1          53    10485760           1  NO  INACTIVE                 273378  26 -SEP -11
          2           1          54    10485760           1  NO  CURRENT                  273381  26 -SEP -11
          4           2           0    10485760           1  YES UNUSED                        0
          5           2           0    10485760           1  YES UNUSED                        0
---激活thread  2  redo
SQL> alter database enable thread  2 ;
Database altered.
 
SQL> select *  from  v$log;
     GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
          1           1          53    10485760           1  NO  INACTIVE                 273378  26 -SEP -11
          2           1          54    10485760           1  NO  CURRENT                  273381  26 -SEP -11
          4           2           1    10485760           1  NO  CURRENT                  273410  26 -SEP -11
          5           2           0    10485760           1  YES UNUSED                        0
  
---启动节点 2  instance 成功
SQL> startup force
ORACLE instance started.
Total System Global Area   213909504  bytes
Fixed Size                   1218604  bytes
Variable Size              109053908  bytes
Database Buffers           100663296  bytes
Redo Buffers                 2973696  bytes
Database mounted.
Database opened.
 
SQL> select instance_name  from  gv$instance;
INSTANCE_NAME
----------------
test2
test1

九、注册database、instance,并验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
[oracle@rac1 dbs]$ srvctl add database -d test -o $ORACLE_HOME
[oracle@rac1 dbs]$ srvctl add instance -d test -i test1 -n rac1
[oracle@rac1 dbs]$ srvctl add instance -d test -i test2 -n rac2
 
[oracle@rac1 dbs]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.prod.db    application    ONLINE    ONLINE    rac2        
ora....d1.inst application    ONLINE    ONLINE    rac1        
ora....d2.inst application    ONLINE    ONLINE    rac2        
ora....SM1.asm application    OFFLINE   OFFLINE               
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2        
ora.test.db    application    OFFLINE   OFFLINE               
ora....t1.inst application    OFFLINE   OFFLINE               
ora....t2.inst application    OFFLINE   OFFLINE 
               
[oracle@rac1 dbs]$ crs_stat|grep asm
NAME=ora.rac1.ASM1.asm
NAME=ora.rac2.ASM2.asm
[oracle@rac1 dbs]$ crs_start -f ora.rac1.ASM1.asm
Attempting to start `ora.rac1.ASM1.asm`  on  member `rac1`
Start of `ora.rac1.ASM1.asm`  on  member `rac1` succeeded.
[oracle@rac1 dbs]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.prod.db    application    ONLINE    ONLINE    rac2        
ora....d1.inst application    ONLINE    ONLINE    rac1        
ora....d2.inst application    ONLINE    ONLINE    rac2        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2        
ora.test.db    application    OFFLINE   OFFLINE               
ora....t1.inst application    OFFLINE   OFFLINE               
ora....t2.inst application    OFFLINE   OFFLINE 
               
[oracle@rac1 dbs]$ crs_stat|grep inst
NAME=ora.prod.prod1.inst
NAME=ora.prod.prod2.inst
NAME=ora.test.test1.inst
NAME=ora.test.test2.inst
 
[oracle@rac1 dbs]$ crs_stat|grep db
NAME=ora.prod.db
NAME=ora.test.db
 
[oracle@rac1 dbs]$ crs_start -f ora.test.test1.inst
Attempting to start `ora.test.test1.inst`  on  member `rac1`
Start of `ora.test.test1.inst`  on  member `rac1` succeeded.
 
[oracle@rac1 dbs]$ crs_start -f ora.test.test2.inst
Attempting to start `ora.test.test2.inst`  on  member `rac2`
Start of `ora.test.test2.inst`  on  member `rac2` succeeded.
 
[oracle@rac1 dbs]$ crs_start -f ora.test.db
Attempting to start `ora.test.db`  on  member `rac1`
Start of `ora.test.db`  on  member `rac1` succeeded.
[oracle@rac1 dbs]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.prod.db    application    ONLINE    ONLINE    rac2        
ora....d1.inst application    ONLINE    ONLINE    rac1        
ora....d2.inst application    ONLINE    ONLINE    rac2        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2        
ora.test.db    application    ONLINE    ONLINE    rac1        
ora....t1.inst application    ONLINE    ONLINE    rac1        
ora....t2.inst application    ONLINE    ONLINE    rac2        
[oracle@rac1 dbs]$

  @ 至此,数据库建立完成!










本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/1365001,如需转载请自行联系原作者
目录
相关文章
|
3月前
|
Oracle 关系型数据库 数据库
Oracle数据恢复—Oracle数据库文件有坏快损坏的数据恢复案例
一台Oracle数据库打开报错,报错信息: “system01.dbf需要更多的恢复来保持一致性,数据库无法打开”。管理员联系我们数据恢复中心寻求帮助,并提供了Oracle_Home目录的所有文件。用户方要求恢复zxfg用户下的数据。 由于数据库没有备份,无法通过备份去恢复数据库。
|
3月前
|
存储 Oracle 关系型数据库
oracle数据恢复—Oracle数据库文件大小变为0kb的数据恢复案例
存储掉盘超过上限,lun无法识别。管理员重组存储的位图信息并导出lun,发现linux操作系统上部署的oracle数据库中有上百个数据文件的大小变为0kb。数据库的大小缩水了80%以上。 取出&并分析oracle数据库的控制文件。重组存储位图信息,重新导出控制文件中记录的数据文件,发现这些文件的大小依然为0kb。
|
2月前
|
存储 Oracle 关系型数据库
服务器数据恢复—华为S5300存储Oracle数据库恢复案例
服务器存储数据恢复环境: 华为S5300存储中有12块FC硬盘,其中11块硬盘作为数据盘组建了一组RAID5阵列,剩下的1块硬盘作为热备盘使用。基于RAID的LUN分配给linux操作系统使用,存放的数据主要是Oracle数据库。 服务器存储故障: RAID5阵列中1块硬盘出现故障离线,热备盘自动激活开始同步数据,在同步数据的过程中又一块硬盘离线,RAID5阵列瘫痪,上层LUN无法使用。
|
4月前
|
存储 Oracle 关系型数据库
数据库数据恢复—Oracle ASM磁盘组故障数据恢复案例
Oracle数据库数据恢复环境&故障: Oracle ASM磁盘组由4块磁盘组成。Oracle ASM磁盘组掉线 ,ASM实例不能mount。 Oracle数据库故障分析&恢复方案: 数据库数据恢复工程师对组成ASM磁盘组的磁盘进行分析。对ASM元数据进行分析发现ASM存储元数据损坏,导致磁盘组无法挂载。
|
5月前
|
Oracle 关系型数据库 数据库
数据库数据恢复—Oracle数据库文件出现坏块的数据恢复案例
打开oracle数据库报错“system01.dbf需要更多的恢复来保持一致性,数据库无法打开”。 数据库没有备份,无法通过备份去恢复数据库。用户方联系北亚企安数据恢复中心并提供Oracle_Home目录中的所有文件,急需恢复zxfg用户下的数据。 出现“system01.dbf需要更多的恢复来保持一致性”这个报错的原因可能是控制文件损坏、数据文件损坏,数据文件与控制文件的SCN不一致等。数据库恢复工程师对数据库文件进一步检测、分析后,发现sysaux01.dbf文件损坏,有坏块。 修复并启动数据库后仍然有许多查询报错,export和data pump工具使用报错。从数据库层面无法修复数据库。
数据库数据恢复—Oracle数据库文件出现坏块的数据恢复案例
|
5月前
|
Oracle 关系型数据库 数据库
Oracle数据恢复—异常断电导致Oracle数据库数据丢失的数据恢复案例
Oracle数据库故障: 机房异常断电后,Oracle数据库启库报错:“system01.dbf需要更多的恢复来保持一致性,数据库无法打开”。数据库没有备份,归档日志不连续。用户方提供了Oracle数据库的在线文件,需要恢复zxfg用户的数据。 Oracle数据库恢复方案: 检测数据库故障;尝试挂起并修复数据库;解析数据文件。
|
4月前
|
Oracle 关系型数据库 数据库
oracle数据恢复—Oracle数据库文件损坏导致数据库打不开的数据恢复案例
打开oracle数据库时报错,报错信息:“system01.dbf需要更多的恢复来保持一致性,数据库无法打开”。急需恢复zxfg用户下的数据。 出现上述报错的原因有:控制文件损坏、数据文件损坏、数据文件与控制文件的SCN不一致等。数据恢复工程师对数据库文件做进一步检测分析后发现sysaux01.dbf文件有坏块。修复sysaux01.dbf文件,启动数据库依然有许多查询报错。export和data pump工具无法使用,查询告警日志并分析报错,确认发生上述错误的原因就是sysaux01.dbf文件损坏。由于该文件损坏,从数据库层面无法修复数据库。由于system和用户表空间的数据文件是正常的,
|
4月前
|
Oracle 关系型数据库 MySQL
shell获取多个oracle库mysql库所有的表
请注意,此脚本假设你有足够的权限访问所有提到的数据库。在实际部署前,请确保对脚本中的数据库凭据、主机名和端口进行适当的修改和验证。此外,处理数据库操作时,务必谨慎操作,避免因错误的脚本执行造成数据损坏或服务中断。
62 0
|
4月前
|
存储 Oracle 关系型数据库
Oracle数据库的应用场景有哪些?
【10月更文挑战第15天】Oracle数据库的应用场景有哪些?
341 64
|
6月前
|
存储 自然语言处理 Oracle
Oracle数据库字符集概述及修改方式
【8月更文挑战第15天】Oracle 数据库字符集定义了数据的编码方案,决定可存储的字符类型及其表示方式。主要作用包括数据存储、检索及跨系统传输时的正确表示。常见字符集如 AL32UTF8 支持多语言,而 WE8MSWIN1252 主用于西欧语言。修改字符集风险高,可能导致数据问题,需事先备份并评估兼容性。可通过 ALTER DATABASE 语句直接修改或采用导出-导入数据的方式进行。完成后应验证数据完整性。此操作复杂,须谨慎处理。
230 5

推荐镜像

更多