具体步骤如下(因为先在12.1中测试,然后才在112.测试,因此这里的测试记录了发现的一些问题和处理方法,而11.2中模拟主机损坏,直接使用了这里的经验,因此没有任何报错信息):
1,安装12.1.0.2的GI软件,如果需要也apply最新的PSU,然后查看磁盘和磁盘组:
[grid@lunarrac ~]$ kfod disks=all ds=true cluster=true status=true
--------------------------------------------------------------------------------
Disk Size Header Path Disk Group User Group
================================================================================
1: 2047 Mb MEMBER /dev/asm-diskb CRSDG grid asmadmin
2: 2047 Mb MEMBER /dev/asm-diskc CRSDG grid asmadmin
3: 2047 Mb MEMBER /dev/asm-diskd CRSDG grid asmadmin
4: 2048 Mb MEMBER /dev/asm-diske DATADG grid asmadmin
5: 2048 Mb MEMBER /dev/asm-diskf DATADG grid asmadmin
6: 2048 Mb MEMBER /dev/asm-diskg DATADG grid asmadmin
7: 3072 Mb MEMBER /dev/asm-diskh DATADG2 grid asmadmin
8: 10240 Mb MEMBER /dev/asm-diski DATADG2 grid asmadmin
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME HOST_NAME
================================================================================
+ASM1 /u01/app/12.1.0.2/grid lunarrac
[grid@lunarrac ~]$
创建ASM的spfile
[grid@lunarrac ~]$ ss
SQL*Plus: Release 12.1.0.2.0 Production on Sun Feb 14 19:08:33 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> create pfile='/tmp/asm.pfile' from spfile;
File created.
SQL>
添加磁盘组'CRSDG', 'DATADG', 'DATADG2'
1
SQL> alter system set asm_diskgroups='CRSDG', 'DATADG', 'DATADG2' scope=both;
System altered.
SQL>
查找spfile:
SYS@+ASM1>SELECT f.group_number, f.file_number, a.name name, f.type type
2 FROM v$asm_file f, v$asm_alias a
3 WHERE f.group_number=a.group_number and f.file_number=a.file_number
4 and f.type='PARAMETERFILE'
5 ORDER BY 1, 2;
GROUP_NUMBER FILE_NUMBER NAME TYPE
---------------- ---------------- ------------------------------------------------------- -------------------------
1 268 spfile.268.903782013 PARAMETERFILE
2 273 spfile.273.892298577 PARAMETERFILE
Elapsed: 00:00:00.16
SYS@+ASM1>
这里看到有两个spfile,哪一个是我们需要的呢?
或者如果这个存储上有多个数据库时,怎么确定哪个数据库使用哪个spfle?
我们知道ASM内部是使用OMF管理数据文件的,因此,它的命名规则是:
因此,根据dbuniquename我们就可以确定哪个数据库使用哪个spfile。
+group/DB_UNIQUE_NAME/file_type/file_type_tag.file#.incarnation#
文件类型是datafile, controlfile, onlinelog等等
ASMCMD> ls -l
Type Redund Striped Time Sys Name
PARAMETERFILE UNPROT COARSE DEC 25 10:00:00 Y spfile.273.892298577
ASMCMD> pwd
+datadg2/lunar/PARAMETERFILE
ASMCMD>
我们将spifle从ASM中复制到文件系统,然后查看其中信息是否正确:
ASMCMD> cp spfile.273.892298577 /tmp/spfile.273.892298577
copying +datadg2/lunar/PARAMETERFILE/spfile.273.892298577 -> /tmp/spfile.273.892298577
ASMCMD> ls -l
Type Redund Striped Time Sys Name
PARAMETERFILE UNPROT COARSE FEB 14 20:00:00 Y spfile.273.892298577
ASMCMD>
查看spfile
[grid@lunarrac ~]$ strings /tmp/spfile.273.892298577
lunar1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
lunar2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
*._gc_policy_time=0
*._gc_undo_affinity=FALSE
*._index_partition_large_extents='FALSE'
*._optimizer_adaptive_cursor_sharing=FALSE
*._optimizer_extended_cursor_sharing='NONE'
*._optimizer_extended_cursor_sharing_rel='NONE'
*._optimizer_null_aware_antijoin=FALSE
*._optimizer_use_feedback=FALSE
*._partition_large_extents='FALSE'
*._PX_use_large_
pool=TRUE
*._undo_autotune=FALSE
*.audit_file_dest='/u01/app/oracle/admin/lunar/adump'
*.audit_trail='NONE'
*.cluster_database=true
*.compatible='12.1.0.2.0'
*.control_files='+DATADG2/LUNAR/CONTROLFILE/current.257.892295167','+DATADG2/LUNAR/CONTROLFILE/current.258.892295171'
*.db_block_size=8192
*.db_cache_size=52428800
*.db_create_file_dest='+DATADG2'
*.db_domain=''
*.db_name='lunar'
*.db_recovery_file_dest='+DATADG2'
*.db_recovery_file_dest_size=5565m
*.db_writer_processes=2
*.defe
rred_segment_creation=FALSE
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=lunarXDB)'
*.event='28401 trace name context forever,level 1','10949 trace name context forever,level 1'
lunar2.instance_number=2
lunar1.instance_number=1
*.java_pool_size=52428800
*.job_queue_processes=5
*.large_pool_size=10485760
*.log_archive_format='%t_%s_%r.dbf'
*.log_buffer=10305536
*.memory_target=0
*.open_cursors=300
*.parallel_force_local=TRUE
*.parallel_max_servers=30
*.pa
rallel_min_servers=30
*.parallel_servers_target=30
*.pga_aggregate_limit=629145600
*.pga_aggregate_target=360m
*.processes=150
*.remote_login_passwordfile='exclusive'
*.resource_limit=TRUE
*.resource_manager_plan=''
*.session_cached_cursors=30
*.sga_target=0
*.shared_pool_size=419430400
lunar2.thread=2
lunar1.thread=1
lunar2.undo_tablespace='UNDOTBS2'
lunar1.undo_tablespace='UNDOTBS1'
[grid@lunarrac ~]$
这时,启动是数据库会报错:
[oracle@lunarrac ~]$ ss
SQL*Plus: Release 12.1.0.2.0 Production on Sun Feb 14 21:05:13 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SYS@lunar1>startup
ORACLE instance started.
Total System Global Area 557842432 bytes
Fixed Size 2926520 bytes
Variable Size 486541384 bytes
Database Buffers 54525952 bytes
Redo Buffers 13848576 bytes
ORA-00205: error in identifying control file, check alert log for more info
SYS@lunar1>
alert中报错如下:
ORACLE_BASE from environment = /u01/app/oracle
Sun Feb 14 21:11:42 2016
ALTER DATABASE MOUNT
Sun Feb 14 21:11:42 2016
This instance was first to mount
Sun Feb 14 21:11:42 2016
NOTE: ASMB mounting group 2 (DATADG2)
Sun Feb 14 21:11:42 2016
ORA-15025: could not open disk "/dev/asm-diskh"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
Sun Feb 14 21:11:42 2016
ORA-15025: could not open disk "/dev/asm-diski"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
NOTE: Disk 0 in group 2 could not be opened.
WARNING: Failed to complete group 2
WARNING: group 2 is being dismounted.
WARNING: ASMB force dismounting group 2 (DATADG2) due to failed mount
SUCCESS: diskgroup DATADG2 was dismounted
NOTE: ASMB mounting group 2 (DATADG2)
Sun Feb 14 21:11:43 2016
ORA-15025: could not open disk "/dev/asm-diskh"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
ORA-15040: diskgroup is incomplete
ORA-15040: diskgroup is incomplete
Sun Feb 14 21:11:43 2016
ORA-15025: could not open disk "/dev/asm-diski"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
NOTE: Disk 0 in group 2 could not be opened.
WARNING: Failed to complete group 2
WARNING: group 2 is being dismounted.
WARNING: ASMB force dismounting group 2 (DATADG2) due to failed mount
SUCCESS: diskgroup DATADG2 was dismounted
Sun Feb 14 21:11:43 2016
ORA-00210: cannot open the specified control file
ORA-00202: control file: '+DATADG2/LUNAR/CONTROLFILE/current.258.892295171'
ORA-17503: ksfdopn:2 Failed to open file +DATADG2/LUNAR/CONTROLFILE/current.258.892295171
ORA-15001: diskgroup "DATADG2" does not exist or is not mounted
ORA-15040: diskgroup is incomplete
ORA-00210: cannot open the specified control file
ORA-00202: control file: '+DATADG2/LUNAR/CONTROLFILE/current.257.892295167'
ORA-17503: ksfdopn:2 Failed to open file +DATADG2/LUNAR/CONTROLFILE/current.257.892295167
ORA-15001: diskgroup "DATADG2" does not exist or is not mounted
ORA-15040: diskgroup is incomplete
ORA-205 signalled during: ALTER DATABASE MOUNT...
Sun Feb 14 21:12:07 2016
Decreasing number of real time LMS from 1 to 0
根据报错信息,我们知道,是因为oracle没有访问asm磁盘组的权限造成的,因此需要修改oracle权限:
[grid@lunarrac ~]$ $ORACLE_HOME/bin/setasmgidwrap o=/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle
[grid@lunarrac ~]$ ls -lrt /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle
-rwsr-s--x 1 oracle asmadmin 323762276 Feb 14 18:15 /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle
[grid@lunarrac ~]$
再次mount数据库,依然报错:
SYS@lunar1>alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info
Elapsed: 00:00:17.22
SYS@lunar1>
报错信息如下:
alter database mount
Sun Feb 14 21:18:10 2016
This instance was first to mount
Process O000 died, see its trace file
Sun Feb 14 21:18:12 2016
NOTE: ASMB mounting group 2 (DATADG2)
Process O000 died, see its trace file
Sun Feb 14 21:18:16 2016
ORA-15025: could not open disk "/dev/asm-diskh"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
ORA-15040: diskgroup is incomplete
ORA-15040: diskgroup is incomplete
Sun Feb 14 21:18:19 2016
ORA-15025: could not open disk "/dev/asm-diski"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
NOTE: Disk 0 in group 2 could not be opened.
WARNING: Failed to complete group 2
Sun Feb 14 21:18:24 2016
WARNING: group 2 is being dismounted.
WARNING: ASMB force dismounting group 2 (DATADG2) due to failed mount
SUCCESS: diskgroup DATADG2 was dismounted
NOTE: ASMB mounting group 2 (DATADG2)
Sun Feb 14 21:18:26 2016
ORA-15025: could not open disk "/dev/asm-diskh"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
ORA-15040: diskgroup is incomplete
ORA-15040: diskgroup is incomplete
Sun Feb 14 21:18:26 2016
ORA-15025: could not open disk "/dev/asm-diski"
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
NOTE: Disk 0 in group 2 could not be opened.
WARNING: Failed to complete group 2
WARNING: group 2 is being dismounted.
WARNING: ASMB force dismounting group 2 (DATADG2) due to failed mount
SUCCESS: diskgroup DATADG2 was dismounted
Sun Feb 14 21:18:26 2016
ORA-00210: cannot open the specified control file
ORA-00202: control file: '+DATADG2/LUNAR/CONTROLFILE/current.258.892295171'
ORA-17503: ksfdopn:2 Failed to open file +DATADG2/LUNAR/CONTROLFILE/current.258.892295171
ORA-15001: diskgroup "DATADG2" does not exist or is not mounted
ORA-15040: diskgroup is incomplete
ORA-00210: cannot open the specified control file
ORA-00202: control file: '+DATADG2/LUNAR/CONTROLFILE/current.257.892295167'
ORA-17503: ksfdopn:2 Failed to open file +DATADG2/LUNAR/CONTROLFILE/current.257.892295167
ORA-15001: diskgroup "DATADG2" does not exist or is not mounted
ORA-15040: diskgroup is incomplete
ORA-205 signalled during: alter database mount
...
Process m000 died, see its trace file
Process m001 died, see its trace file
Process m000 died, see its trace file
Process m000 died, see its trace file
Process m001 died, see its trace file
Process m000 died, see its trace file
具体的trace文件如下:
Trace file /u01/app/oracle/diag/rdbms/lunar/lunar1/trace/lunar1_m000_14358.trc
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/12.1.0.2/dbhome_1
System name: Linux
Node name: lunarrac
Release: 3.8.13-44.1.1.el6uek.x86_64
Version: #2 SMP Wed Sep 10 06:10:25 PDT 2014
Machine: x86_64
Instance name: lunar1
Redo thread mounted by this instance: 0
Oracle process number: 0
Unix process pid: 14358, image:
*** 2016-02-14 21:20:01.641
Died during process startup with error 27140 (seq=94)
OPIRIP: Uncaught error 27140. Error stack:
ORA-27140: attach to post/wait facility failed
ORA-27300: OS system dependent operation:invalid_egid failed with status: 1
ORA-27301: OS failure message: Operation not permitted
ORA-27302: failure occurred at: skgpwinit6
ORA-27303: additional information: startup egid = 6000 (oinstall), current egid = 5000 (asmadmin)
~
这里看到,应该是数据库还是不能访问磁盘组,将磁盘组注册到ocr中的过程如下:
SQL> alter diskgroup datadg mount
Sun Feb 14 21:42:56 2016
NOTE: cache registered group DATADG 2/0x4BA26F20
NOTE: cache began mount (first) of group DATADG 2/0x4BA26F20
NOTE: Assigning number (2,1) to disk (/dev/asm-diskf)
NOTE: Assigning number (2,2) to disk (/dev/asm-diskg)
NOTE: Assigning number (2,0) to disk (/dev/asm-diske)
Sun Feb 14 21:43:02 2016
NOTE: GMON heartbeating for grp 2 (DATADG)
GMON querying group 2 at 17 for pid 30, osid 19564
Sun Feb 14 21:43:02 2016
NOTE: cache is mounting group DATADG created on 2015/10/05 07:49:39
NOTE: cache opening disk 0 of grp 2: DATADG_0000 path:/dev/asm-diske
NOTE: 02/14/16 21:43:02 DATADG.F1X0 found on disk 0 au 10 fcn 0.0 datfmt 1
NOTE: cache opening disk 1 of grp 2: DATADG_0001 path:/dev/asm-diskf
NOTE: 02/14/16 21:43:02 DATADG.F1X0 found on disk 1 au 10 fcn 0.0 datfmt 1
NOTE: cache opening disk 2 of grp 2: DATADG_0002 path:/dev/asm-diskg
NOTE: 02/14/16 21:43:02 DATADG.F1X0 found on disk 2 au 10 fcn 0.0 datfmt 1
Sun Feb 14 21:43:02 2016
NOTE: cache mounting (first) normal redundancy group 2/0x4BA26F20 (DATADG)
Sun Feb 14 21:43:02 2016
* allocate domain 2, invalid = TRUE
Sun Feb 14 21:43:03 2016
NOTE: attached to recovery domain 2
Sun Feb 14 21:43:03 2016
* validated domain 2, flags = 0x0
NOTE: cache recovered group 2 to fcn 0.73
NOTE: redo buffer size is 256 blocks (1056768 bytes)
Sun Feb 14 21:43:03 2016
NOTE: LGWR attempting to mount thread 1 for diskgroup 2 (DATADG)
NOTE: LGWR found thread 1 closed at ABA 11.22 lock domain=0 inc#=0 instnum=1
NOTE: LGWR mounted thread 1 for diskgroup 2 (DATADG)
Sun Feb 14 21:43:03 2016
NOTE: LGWR opened thread 1 (DATADG) at fcn 0.73 ABA 12.23 lock domain=2 inc#=2 instnum=1 gx.incarn=1268936480 mntstmp=2016/02/14 21:43:03.557000
Sun Feb 14 21:43:03 2016
NOTE: cache mounting group 2/0x4BA26F20 (DATADG) succeeded
NOTE: cache ending mount (success) of group DATADG number=2 incarn=0x4ba26f20
Sun Feb 14 21:43:03 2016
NOTE: Instance updated compatible.asm to 12.1.0.0.0 for grp 2
Sun Feb 14 21:43:03 2016
SUCCESS: diskgroup DATADG was mounted
Sun Feb 14 21:43:03 2016
SUCCESS: alter diskgroup datadg mount
Sun Feb 14 21:43:04 2016
NOTE: diskgroup resource ora.DATADG.dg is online
WARNING: unknown state for diskgroup resource ora.DATADG.dg, Return Value: 3
再次查看,ocr中已经包含了这些磁盘组
[root@lunarrac ~]# crsctl status res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
ONLINE ONLINE lunarrac STABLE
ora.DATADG.dg
ONLINE ONLINE lunarrac STABLE
ora.DATADG2.dg
ONLINE ONLINE lunarrac STABLE
ora.LISTENER.lsnr
ONLINE ONLINE lunarrac STABLE
ora.asm
ONLINE ONLINE lunarrac Started,STABLE
ora.net1.network
ONLINE ONLINE lunarrac STABLE
ora.ons
ONLINE ONLINE lunarrac STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE lunarrac STABLE
ora.MGMTLSNR
1 ONLINE ONLINE lunarrac 169.254.52.98 192.16
8.60.56,STABLE
ora.cvu
1 ONLINE ONLINE lunarrac STABLE
ora.lunarrac.vip
1 ONLINE ONLINE lunarrac STABLE
ora.mgmtdb
1 OFFLINE OFFLINE STABLE
ora.oc4j
1 ONLINE ONLINE lunarrac STABLE
ora.scan1.vip
1 ONLINE ONLINE lunarrac STABLE
--------------------------------------------------------------------------------
[root@lunarrac ~]#
将数据库注册到ocr中:
在12.1中如果沿用11.2的配置数据库命令,那么数据库可以启动,但是可以发现配置信息是有问题的:
例如,“Database name: lunarrac”这里显示lunarrac是我的主机名,而数据库名是lunar,因此使用112.的命令注册数据库到ocr会有其他未知问题
建议,在不同版本,根据不同版本的命令进行注册。
[oracle@lunarrac ~]$ srvctl add database -d lunar -n lunarrac -o $ORACLE_HOME -p +datadg2/lunar/PARAMETERFILE/spfile.273.892298577 -s OPEN -y AUTOMATIC -a "CRSDG,DATADG,DATADG2" -t IMMEDIATE
[oracle@lunarrac ~]$ srvctl config database -d lunar
Database unique name: lunar
Database name: lunarrac
Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_1
Oracle user: oracle
Spfile: +datadg2/lunar/PARAMETERFILE/spfile.273.892298577
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: CRSDG,DATADG,DATADG2
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oinstall
Database instances:
Configured nodes:
Database is administrator managed
[oracle@lunarrac ~]$
检查crs状态,数据库已经注册进去了:
[root@lunarrac ~]# crsctl status res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
ONLINE ONLINE lunarrac STABLE
ora.DATADG.dg
ONLINE ONLINE lunarrac STABLE
ora.DATADG2.dg
ONLINE ONLINE lunarrac STABLE
ora.LISTENER.lsnr
ONLINE ONLINE lunarrac STABLE
ora.asm
ONLINE ONLINE lunarrac Started,STABLE
ora.net1.network
ONLINE ONLINE lunarrac STABLE
ora.ons
ONLINE ONLINE lunarrac STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE lunarrac STABLE
ora.MGMTLSNR
1 ONLINE ONLINE lunarrac 169.254.52.98 192.16
8.60.56,STABLE
ora.cvu
1 ONLINE ONLINE lunarrac STABLE
ora.lunar.db
1 OFFLINE OFFLINE STABLE
ora.lunarrac.vip
1 ONLINE ONLINE lunarrac STABLE
ora.mgmtdb
1 OFFLINE OFFLINE STABLE
ora.oc4j
1 ONLINE ONLINE lunarrac STABLE
ora.scan1.vip
1 ONLINE ONLINE lunarrac STABLE
--------------------------------------------------------------------------------
[root@lunarrac ~]#
启动数据库:
[oracle@lunarrac ~]$ srvctl start database -d lunar
[oracle@lunarrac ~]$
.
[root@lunarrac ~]# crsctl status res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
ONLINE ONLINE lunarrac STABLE
ora.DATADG.dg
ONLINE ONLINE lunarrac STABLE
ora.DATADG2.dg
ONLINE ONLINE lunarrac STABLE
ora.LISTENER.lsnr
ONLINE ONLINE lunarrac STABLE
ora.asm
ONLINE ONLINE lunarrac Started,STABLE
ora.net1.network
ONLINE ONLINE lunarrac STABLE
ora.ons
ONLINE ONLINE lunarrac STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE lunarrac STABLE
ora.MGMTLSNR
1 ONLINE ONLINE lunarrac 169.254.52.98 192.16
8.60.56,STABLE
ora.cvu
1 ONLINE ONLINE lunarrac STABLE
ora.lunar.db
1 ONLINE ONLINE lunarrac Open,STABLE
ora.lunarrac.vip
1 ONLINE ONLINE lunarrac STABLE
ora.mgmtdb
1 OFFLINE OFFLINE STABLE
ora.oc4j
1 ONLINE ONLINE lunarrac STABLE
ora.scan1.vip
1 ONLINE ONLINE lunarrac STABLE
--------------------------------------------------------------------------------
[root@lunarrac ~]#
在挂完老存储后,还需要检查口令文件,如果有必要,需要重新给sys和system授予sysdba,sysoper权限,以便使用操作系统认证方式登录数据库。