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

来源:互联网 发布:阿拉斯加大学 知乎 编辑:程序博客网 时间:2024/05/17 03:50

1.在solaris安装过程报错,



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

3.重新卸载



4.特别是关键的文件

ohasd和 init.ohasd

root@NXHXW # cd ohasdohasd: not a directoryroot@NXHXW # mv ohasd bak_ohasdroot@NXHXW # mv init.ohasd bak_init.ohasd

5.正常了



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


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

root@NXHXW # /u01/app/oraInventory/orainstRoot.shChanging 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.shPerforming root user operation for Oracle 11g The following environment variables are set as:    ORACLE_OWNER= grid    ORACLE_HOME=  /u01/app/crs_homeEnter 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 byDatabase Configuration Assistant when a database is createdFinished 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.plTo configure Grid Infrastructure for a Cluster execute the following command:/u01/app/crs_home/crs/config/config.shThis 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.plUsing configuration parameter file: /u01/app/crs_home/crs/install/crsconfig_paramsCreating trace directoryLOCAL 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 inittabnxhxw     2017/07/05 11:17:11     /u01/app/crs_home/cdata/nxhxw/backup_20170705_111711.olrSuccessfully configured Oracle Grid Infrastructure for a Standalone Serverroot@NXHXW # 

7.安装database only

中间步骤省。。。



还需执行脚本

root@NXHXW # /u01/app/oracle/product/11.2.0/dbhome_1/root.shPerforming 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_1Enter 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 byDatabase Configuration Assistant when a database is createdFinished running generic part of root script.Now product-specific root actions will be performed.Finished product-specific root actions.

正常。


8.下面启动crs


9.磁阵赋权

root@NXHXW # chown 660 ssd*g,rawroot@NXHXW # chown grid:oinstall ssd*g,rawroot@NXHXW # ls -l |grep g,rawcrw-rw---- 1 grid oinstall 118, 1238 Jul 4 18:30 ssd@g6001438007f3040900005000003b0000:g,rawcrw-rw---- 1 grid oinstall 118, 1222 Jul 4 18:30 ssd@g6001438007f304090000500000430000:g,rawcrw-rw---- 1 grid oinstall 118, 1214 Jul 4 18:30 ssd@g6001438007f304090000500000470000:g,rawcrw-rw---- 1 grid oinstall 118, 1206 Jul 4 18:30 ssd@g6001438007f3040900005000004b0000:g,rawcrw-rw---- 1 grid oinstall 118, 1198 Jul 4 18:30 ssd@g6001438007f3040900005000004f0000:g,rawcrw-rw---- 1 grid oinstall 118, 1190 Jul 4 18:30 ssd@g6001438007f304090000500000530000:g,rawcrw-rw---- 1 grid oinstall 118, 1182 Jul 4 18:30 ssd@g6001438007f304090000500000570000:g,rawcrw-rw---- 1 grid oinstall 118, 1174 Jul 4 18:30 ssd@g6001438007f3040900005000005b0000:g,rawcrw-rw---- 1 grid oinstall 118, 1166 Jul 4 18:30 ssd@g6001438007f3040900005000005f0000:g,rawcrw-rw---- 1 grid oinstall 118, 1158 Jul 4 18:30 ssd@g6001438007f304090000500000630000:g,rawcrw-rw---- 1 grid oinstall 118, 1150 Jul 4 18:30 ssd@g6001438007f304090000500000670000:g,rawcrw-rw---- 1 grid oinstall 118, 1142 Jul 4 18:30 ssd@g6001438007f3040900005000006b0000:g,rawcrw-rw---- 1 grid oinstall 118, 1134 Jul 4 18:30 ssd@g6001438007f3040900005000006f0000:g,rawcrw-rw---- 1 grid oinstall 118, 1126 Jul 4 18:30 ssd@g6001438007f304090000500000730000:g,rawcrw-rw---- 1 grid oinstall 118, 1118 Jul 4 18:30 ssd@g6001438007f304090000500000770000:g,rawcrw-rw---- 1 grid oinstall 118, 1110 Jul 4 18:30 ssd@g6001438007f3040900005000007b0000:g,rawcrw-rw---- 1 grid oinstall 118, 1102 Jul 4 18:30 ssd@g6001438007f3040900005000007f0000:g,rawcrw-rw---- 1 grid oinstall 118, 1094 Jul 4 18:30 ssd@g6001438007f304090000500000830000:g,rawcrw-rw---- 1 grid oinstall 118, 1086 Jul 4 18:30 ssd@g6001438007f304090000500000870000:g,rawcrw-rw---- 1 grid oinstall 118, 1078 Jul 4 18:30 ssd@g6001438007f3040900005000008b0000:g,rawcrw-rw---- 1 grid oinstall 118, 1070 Jul 4 18:30 ssd@g6001438007f3040900005000008f0000:g,rawcrw-rw---- 1 grid oinstall 118, 1062 Jul 4 18:30 ssd@g6001438007f304090000500000930000:g,rawcrw-rw---- 1 grid oinstall 118, 1054 Jul 4 18:30 ssd@g6001438007f304090000500000970000:g,rawcrw-rw---- 1 grid oinstall 118, 1046 Jul 4 18:30 ssd@g6001438007f3040900005000009b0000:g,rawcrw-rw---- 1 grid oinstall 118, 1038 Jul 4 18:30 ssd@g6001438007f3040900005000009f0000:g,rawcrw-rw---- 1 grid oinstall 118, 1030 Jul 4 18:30 ssd@g6001438007f304090000500000a30000:g,rawcrw-rw---- 1 grid oinstall 118, 1022 Jul 4 18:30 ssd@g6001438007f304090000500000a70000:g,rawcrw-rw---- 1 grid oinstall 118, 1014 Jul 4 18:30 ssd@g6001438007f304090000500000ab0000:g,rawcrw-rw---- 1 grid oinstall 118, 1006 Jul 4 18:30 ssd@g6001438007f304090000500000af0000:g,rawcrw-rw---- 1 grid oinstall 118, 1230 Jul 4 18:30 ssd@g6001438007f304090000500000b30000:g,rawcrw-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.cssdCRS-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' succeededCRS-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                                                   $ iduid=1101(grid) gid=1000(oinstall)

11.mount磁阵

$ sqlplus / as sysasmSQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 5 12:28:19 2017Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to an idle instance.SQL> startup pfile='/export/home/grid/pfile.asm';ASM instance startedTotal System Global Area  634896384 bytesFixed Size                  2184152 bytesVariable Size             607546408 bytesASM Cache                  25165824 bytesORA-15110: no diskgroups mountedSQL> select name,state,total_mb,free_mb from v$asm_diskgroup;NAME                           STATE         TOTAL_MB    FREE_MB------------------------------ ----------- ---------- ----------DGDATA                         DISMOUNTED           0          0SQL> 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    3283458SQL> exit


12.启动实例

启动失败

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

说明缺参数,查看参数文件位置
spfileunicom.oraASMCMD> pwd+DGDATA/UNICOMASMCMD> 


13.做启动参数脚本


14.重新启动

$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 5 12:45:51 2017Copyright (c) 1982, 2013, Oracle.  All rights reserved.Connected to an idle instance.SQL> startupORA-01078: failure in processing system parametersLRM-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 fileORA-01078: failure in processing system parametersSQL> startupORACLE instance started.Total System Global Area 2.7400E+10 bytesFixed Size                  2194584 bytesVariable Size            1.3153E+10 bytesDatabase Buffers         1.4160E+10 bytesRedo Buffers               84475904 bytesDatabase mounted.ORA-01092: ORACLE instance terminated. Disconnection forcedORA-00704: bootstrap process failureORA-39700: database must be opened with UPGRADE optionProcess ID: 14198Session ID: 1441 Serial number: 3


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


15.升级

[oracle@ekptest001 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.3.0 Production on 星期三 12月 24 15:31:16 2014Copyright (c) 1982, 2011, Oracle. All rights reserved.已连接到空闲例程。SQL> startup mount;ORACLE 例程已经启动。Total System Global Area 6797832192 bytesFixed Size 2241264 bytesVariable Size 3523218704 bytesDatabase Buffers 3254779904 bytesRedo Buffers 17592320 bytes数据库装载完毕。SQL> alter database open upgrade;数据库已更改。SQL> select status from v$Instance;STATUS------------------------------------OPEN MIGRATESQL> @$ORACLE_HOME/rdbms/admin/catupgrd.sql;这里要等1小时左右。


16.启动实例

 Connected to an idle instance.SQL> startupORACLE instance started.Total System Global Area 2.7400E+10 bytesFixed Size                  2194584 bytesVariable Size            1.3220E+10 bytesDatabase Buffers         1.4093E+10 bytesRedo Buffers               84475904 bytesDatabase mounted.Database opened.SQL> select * from v$version;BANNER--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionPL/SQL Release 11.2.0.4.0 - ProductionCORE    11.2.0.4.0      ProductionTNS for Solaris: Version 11.2.0.4.0 - ProductionNLSRTL Version 11.2.0.4.0 - Production

17,检查监听

root@NXHXW # su - gridOracle Corporation      SunOS 5.10      Generic Patch   January 2005$ iduid=1101(grid) gid=1000(oinstall)$ lsnrctl statusLSNRCTL for Solaris: Version 11.2.0.4.0 - Production on 05-JUL-2017 15:32:06Copyright (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 startLSNRCTL for Solaris: Version 11.2.0.4.0 - Production on 05-JUL-2017 15:42:42Copyright (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 - ProductionLog messages written to /u01/app/crs_base/diag/tnslsnr/NXHXW/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NXHXW)(PORT=1521)))Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))STATUS of the LISTENER------------------------Alias                     LISTENERVersion                   TNSLSNR for Solaris: Version 11.2.0.4.0 - ProductionStart Date                05-JUL-2017 15:42:42Uptime                    0 days 0 hr. 0 min. 0 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Log File         /u01/app/crs_base/diag/tnslsnr/NXHXW/listener/alert/log.xmlListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=NXHXW)(PORT=1521)))The listener supports no servicesThe 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                $ exitroot@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 asmCRS-2613: Could not find resource 'asm'.CRS-4000: Command Start failed, or completed with errors.$ srvctl enable asmPRCC-1010 : asm was already enabledPRCR-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.dgCRS-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