solaris操作系统损坏,恢复数据库

1.在solaris安装过程报错,



2.说明有进程存在,或者文件存在,这就是oracle的bug了, 重新安装就应该覆盖哦。

3.重新卸载



4.特别是关键的文件

ohasd和 init.ohasd

root@NXHXW # cd ohasd
ohasd: not a directory
root@NXHXW # mv ohasd bak_ohasd
root@NXHXW # mv init.ohasd bak_init.ohasd

5.正常了



6.因为我是恢复数据库, 所以只需安装grid,选择是only install grid software


注意下面,有选择是执行rac或者是asm单机,执行第2个脚本

root@NXHXW # /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
root@NXHXW # /u01/app/crs_home/root.sh
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/crs_home

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.


Creating /var/opt/oracle/oratab file...
Entries will be added to the /var/opt/oracle/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

To configure Grid Infrastructure for a Stand-Alone Server run the following command as the root user:
/u01/app/crs_home/perl/bin/perl -I/u01/app/crs_home/perl/lib -I/u01/app/crs_home/crs/install /u01/app/crs_home/crs/install/roothas.pl


To configure Grid Infrastructure for a Cluster execute the following command:
/u01/app/crs_home/crs/config/config.sh
This command launches the Grid Infrastructure Configuration Wizard. The wizard also supports silent operation, and the parameters can be passed through the response file that is available in the installation media.

root@NXHXW # /u01/app/crs_home/perl/bin/perl -I/u01/app/crs_home/perl/lib -I/u01/app/crs_home/crs/install /u01/app/crs_home/crs/install/roothas.pl
Using configuration parameter file: /u01/app/crs_home/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE 
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node nxhxw successfully pinned.
Adding Clusterware entries to inittab

nxhxw     2017/07/05 11:17:11     /u01/app/crs_home/cdata/nxhxw/backup_20170705_111711.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
root@NXHXW # 

7.安装database only

中间步骤省。。。



还需执行脚本

root@NXHXW # /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /var/opt/oracle/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

正常。


8.下面启动crs


9.磁阵赋权

cd   /devices/scsi_vhci

root@NXHXW # chown 660 ssd*g,raw
root@NXHXW # chown grid:oinstall ssd*g,raw
root@NXHXW # ls -l |grep g,raw
crw-rw---- 1 grid oinstall 118, 1238 Jul 4 18:30 ssd@g6001438007f3040900005000003b0000:g,raw
crw-rw---- 1 grid oinstall 118, 1222 Jul 4 18:30 ssd@g6001438007f304090000500000430000:g,raw
crw-rw---- 1 grid oinstall 118, 1214 Jul 4 18:30 ssd@g6001438007f304090000500000470000:g,raw
crw-rw---- 1 grid oinstall 118, 1206 Jul 4 18:30 ssd@g6001438007f3040900005000004b0000:g,raw
crw-rw---- 1 grid oinstall 118, 1198 Jul 4 18:30 ssd@g6001438007f3040900005000004f0000:g,raw
crw-rw---- 1 grid oinstall 118, 1190 Jul 4 18:30 ssd@g6001438007f304090000500000530000:g,raw
crw-rw---- 1 grid oinstall 118, 1182 Jul 4 18:30 ssd@g6001438007f304090000500000570000:g,raw
crw-rw---- 1 grid oinstall 118, 1174 Jul 4 18:30 ssd@g6001438007f3040900005000005b0000:g,raw
crw-rw---- 1 grid oinstall 118, 1166 Jul 4 18:30 ssd@g6001438007f3040900005000005f0000:g,raw
crw-rw---- 1 grid oinstall 118, 1158 Jul 4 18:30 ssd@g6001438007f304090000500000630000:g,raw
crw-rw---- 1 grid oinstall 118, 1150 Jul 4 18:30 ssd@g6001438007f304090000500000670000:g,raw
crw-rw---- 1 grid oinstall 118, 1142 Jul 4 18:30 ssd@g6001438007f3040900005000006b0000:g,raw
crw-rw---- 1 grid oinstall 118, 1134 Jul 4 18:30 ssd@g6001438007f3040900005000006f0000:g,raw
crw-rw---- 1 grid oinstall 118, 1126 Jul 4 18:30 ssd@g6001438007f304090000500000730000:g,raw
crw-rw---- 1 grid oinstall 118, 1118 Jul 4 18:30 ssd@g6001438007f304090000500000770000:g,raw
crw-rw---- 1 grid oinstall 118, 1110 Jul 4 18:30 ssd@g6001438007f3040900005000007b0000:g,raw
crw-rw---- 1 grid oinstall 118, 1102 Jul 4 18:30 ssd@g6001438007f3040900005000007f0000:g,raw
crw-rw---- 1 grid oinstall 118, 1094 Jul 4 18:30 ssd@g6001438007f304090000500000830000:g,raw
crw-rw---- 1 grid oinstall 118, 1086 Jul 4 18:30 ssd@g6001438007f304090000500000870000:g,raw
crw-rw---- 1 grid oinstall 118, 1078 Jul 4 18:30 ssd@g6001438007f3040900005000008b0000:g,raw
crw-rw---- 1 grid oinstall 118, 1070 Jul 4 18:30 ssd@g6001438007f3040900005000008f0000:g,raw
crw-rw---- 1 grid oinstall 118, 1062 Jul 4 18:30 ssd@g6001438007f304090000500000930000:g,raw
crw-rw---- 1 grid oinstall 118, 1054 Jul 4 18:30 ssd@g6001438007f304090000500000970000:g,raw
crw-rw---- 1 grid oinstall 118, 1046 Jul 4 18:30 ssd@g6001438007f3040900005000009b0000:g,raw
crw-rw---- 1 grid oinstall 118, 1038 Jul 4 18:30 ssd@g6001438007f3040900005000009f0000:g,raw
crw-rw---- 1 grid oinstall 118, 1030 Jul 4 18:30 ssd@g6001438007f304090000500000a30000:g,raw
crw-rw---- 1 grid oinstall 118, 1022 Jul 4 18:30 ssd@g6001438007f304090000500000a70000:g,raw
crw-rw---- 1 grid oinstall 118, 1014 Jul 4 18:30 ssd@g6001438007f304090000500000ab0000:g,raw
crw-rw---- 1 grid oinstall 118, 1006 Jul 4 18:30 ssd@g6001438007f304090000500000af0000:g,raw
crw-rw---- 1 grid oinstall 118, 1230 Jul 4 18:30 ssd@g6001438007f304090000500000b30000:g,raw
crw-rw---- 1 grid oinstall 118, 998  Jul 4 18:30 ssd@g6001438007f304090000500000b70000:g,raw


9.检查资源

$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
               OFFLINE OFFLINE      nxhxw                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        OFFLINE OFFLINE                                                   
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       nxhxw                                        
ora.unicom.db
      1        OFFLINE OFFLINE 

10.恢复css

$ crsctl start res ora.cssd
CRS-2672: Attempting to start 'ora.cssd' on 'nxhxw'
CRS-2672: Attempting to start 'ora.diskmon' on 'nxhxw'
CRS-2676: Start of 'ora.diskmon' on 'nxhxw' succeeded
CRS-2676: Start of 'ora.cssd' on 'nxhxw' succeeded
$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
               OFFLINE OFFLINE      nxhxw                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       nxhxw                                        
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       nxhxw                                        
ora.unicom.db
      1        OFFLINE OFFLINE                                                   
$ id
uid=1101(grid) gid=1000(oinstall)

11.mount磁阵

$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 5 12:28:19 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup pfile='/export/home/grid/pfile.asm';
ASM instance started

Total System Global Area  634896384 bytes
Fixed Size                  2184152 bytes
Variable Size             607546408 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted


SQL> select name,state,total_mb,free_mb from v$asm_diskgroup;

NAME                           STATE         TOTAL_MB    FREE_MB
------------------------------ ----------- ---------- ----------
DGDATA                         DISMOUNTED           0          0

SQL> alter diskgroup DGDATA mount;

Diskgroup altered.

SQL> select name,state,total_mb,free_mb from v$asm_diskgroup;

NAME                           STATE         TOTAL_MB    FREE_MB
------------------------------ ----------- ---------- ----------
DGDATA                         MOUNTED        8125472    3283458

SQL> exit


12.启动实例

启动失败

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initunicom.ora'

说明缺参数,查看参数文件位置
spfileunicom.ora
ASMCMD> pwd
+DGDATA/UNICOM
ASMCMD> 


13.做启动参数脚本


14.重新启动

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 5 12:45:51 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initunicom.ora'
SQL> startup pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/pfile_0715.ora';
LRM-00123: invalid character 1 found in the input file
ORA-01078: failure in processing system parameters
SQL> startup
ORACLE instance started.

Total System Global Area 2.7400E+10 bytes
Fixed Size                  2194584 bytes
Variable Size            1.3153E+10 bytes
Database Buffers         1.4160E+10 bytes
Redo Buffers               84475904 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 14198
Session ID: 1441 Serial number: 3


启动失败,提示database要升级,版本匹配,
因为原版本是11.2.0.1.0  
我安装的是 11.2.0.4.0


15.升级

[oracle@ekptest001 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on 星期三 12月 24 15:31:16 2014

Copyright (c) 1982, 2011, Oracle. All rights reserved.

已连接到空闲例程。

SQL> startup mount;

ORACLE 例程已经启动。

Total System Global Area 6797832192 bytes

Fixed Size 2241264 bytes

Variable Size 3523218704 bytes

Database Buffers 3254779904 bytes

Redo Buffers 17592320 bytes

数据库装载完毕。

SQL> alter database open upgrade;

数据库已更改。

SQL> select status from v$Instance;

STATUS

------------------------------------

OPEN MIGRATE

SQL> @$ORACLE_HOME/rdbms/admin/catupgrd.sql;
这里要等1小时左右。


16.启动实例

 
Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 2.7400E+10 bytes
Fixed Size                  2194584 bytes
Variable Size            1.3220E+10 bytes
Database Buffers         1.4093E+10 bytes
Redo Buffers               84475904 bytes
Database mounted.
Database opened.
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Solaris: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

17,检查监听

root@NXHXW # su - grid
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
$ id
uid=1101(grid) gid=1000(oinstall)
$ lsnrctl status

LSNRCTL for Solaris: Version 11.2.0.4.0 - Production on 05-JUL-2017 15:32:06

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Solaris Error: 146: Connection refused
$ lsnrctl start

LSNRCTL for Solaris: Version 11.2.0.4.0 - Production on 05-JUL-2017 15:42:42

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Starting /u01/app/crs_home/bin/tnslsnr: please wait...

TNSLSNR for Solaris: Version 11.2.0.4.0 - Production
Log messages written to /u01/app/crs_base/diag/tnslsnr/NXHXW/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NXHXW)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 11.2.0.4.0 - Production
Start Date                05-JUL-2017 15:42:42
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/crs_base/diag/tnslsnr/NXHXW/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NXHXW)(PORT=1521)))
The listener supports no services
The command completed successfully

18.查看资源状态

$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
               OFFLINE OFFLINE      nxhxw                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       nxhxw                                        
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       nxhxw                                        
ora.unicom.db
      1        ONLINE  ONLINE       nxhxw                    Open                
$ exit
root@NXHXW # 

有2个offline,其实是显示问题,把对应的服务拉起就可以了


$ crsctl start res ora.diskmon -init
CRS-2672: Attempting to start 'ora.diskmon' on 'nxhxw'

CRS-2676: Start of 'ora.diskmon' on 'nxhxw' succeeded


19.查看添加asm资源

增加asm
$ srvctl add asm
$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.asm
               OFFLINE OFFLINE      nxhxw                                        
ora.ons
               ONLINE  ONLINE       nxhxw                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       nxhxw                                        
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       nxhxw                                        
ora.unicom.db
      1        ONLINE  ONLINE       nxhxw                    Open  
      

$ crsctl start res asm
CRS-2613: Could not find resource 'asm'.
CRS-4000: Command Start failed, or completed with errors.
$ srvctl enable asm
PRCC-1010 : asm was already enabled
PRCR-1002 : Resource ora.asm is already enabled
$ srvctl start asm
$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.asm
               ONLINE  ONLINE       nxhxw                    Started             
ora.ons
               ONLINE  ONLINE       nxhxw                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       nxhxw                                        
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       nxhxw                                        
ora.unicom.db
      1        ONLINE  ONLINE       nxhxw                    Open      
      

20.添加DG磁盘组到资源,出现了unknown

#crsctl add res ora.DGDATA.dg -type ora.diskgroup.type 


原因是:

auto_start =nerver



那么我们删除,重新添加

$ crsctl delete res ora.DGDATA.dg

$ crsctl add res ora.DGDATA.dg -type ora.diskgroup.type -attr "ACL='owner:grid:rwx,pgrp:oinstall:rwx,other::r--',AUTO_START=always,VERSION=11.2.0.4.0" -i
$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DGDATA.dg
               OFFLINE OFFLINE      nxhxw                                        
ora.LISTENER2.lsnr
               ONLINE  ONLINE       nxhxw                                        
ora.asm
               ONLINE  ONLINE       nxhxw                    Started             
ora.ons
               ONLINE  ONLINE       nxhxw                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       nxhxw                                        
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       nxhxw                                        
ora.unicom.db
      1        ONLINE  ONLINE       nxhxw                    Open                
$ crsctl start res ora.DGDATA.dg
CRS-2672: Attempting to start 'ora.DGDATA.dg' on 'nxhxw'
CRS-2676: Start of 'ora.DGDATA.dg' on 'nxhxw' succeeded
$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DGDATA.dg
               ONLINE  ONLINE       nxhxw                                        
ora.LISTENER2.lsnr
               ONLINE  ONLINE       nxhxw                                        
ora.asm
               ONLINE  ONLINE       nxhxw                    Started             
ora.ons
               ONLINE  ONLINE       nxhxw                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       nxhxw                                        
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       nxhxw                                        
ora.unicom.db
      1        ONLINE  ONLINE       nxhxw                    Open        

添加之后,查看状态


----------------------------------

完成
2017.7.5     20:00:00
--------end---------------------


写得来需求,改得来bug,安装得来数据库,做得来优化。 666

 
 
 

                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值