понедельник, 22 августа 2011 г.

Reconfigure Oracle Restart

1. Remove Oracle Restart configuration
This step should be performed as privileged (root) user.

-bash-3.00$ su -
Password:
Oracle Corporation SunOS 5.10 Generic Patch January 2005
You have new mail.

# /u01/app/11.2.0.2/grid/perl/bin/perl -I /u01/app/11.2.0.2/grid/perl/lib -I /u01/app/11.2.0.2/grid/crs/install /u01/app/11.2.0.2/grid/crs/install/roothas.pl -deconfig -force


Using configuration parameter file: /u01/app/11.2.0.2/grid/crs/install/crsconfig_params
CRS resources for listeners are still configured
PRKO-2573 : ONS daemon is already stopped.
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'sf480'
CRS-2673: Attempting to stop 'ora.catdb.db' on 'sf480'
CRS-2677: Stop of 'ora.DATA.dg' on 'sf480' succeeded
CRS-2677: Stop of 'ora.catdb.db' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'sf480'
CRS-2677: Stop of 'ora.asm' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'sf480'
CRS-2677: Stop of 'ora.cssd' on 'sf480' succeeded
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'sf480'
CRS-2673: Attempting to stop 'ora.diskmon' on 'sf480'
CRS-2677: Stop of 'ora.diskmon' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'sf480'
CRS-2677: Stop of 'ora.evmd' on 'sf480' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'sf480' has completed
CRS-4133: Oracle High Availability Services has been stopped.
ACFS-9200: Supported
Successfully deconfigured Oracle Restart stack
#

2. Reconfigure Oracle Restart
This step should also be performed as privileged (root) user.

# /u01/app/11.2.0.2/grid/perl/bin/perl -I /u01/app/11.2.0.2/grid/perl/lib -I /u01/app/11.2.0.2/grid/crs/install /u01/app/11.2.0.2/grid/crs/install/roothas.pl


Using configuration parameter file: /u01/app/11.2.0.2/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'oragrid', 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 sf480 successfully pinned.
Adding daemon to inittab
ACFS-9300: ADVM/ACFS distribution files found.
ACFS-9307: Installing requested ADVM/ACFS software.
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9309: ADVM/ACFS installation correctness verified.

sf480 2011/08/22 16:44:59 /u01/app/11.2.0.2/grid/cdata/sf480/backup_20110822_164459.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
#


3. Add ASM back to Oracle Restart configuration
This step should be performed as Grid Infrastructure owner (grid user).

#su - oragrid

:sf480:~$id
uid=701(oragrid) gid=100(oinstall)
:sf480:~$srvctl config asm
PRCR-1001 : Resource ora.asm does not exist
:sf480:~$srvctl add asm -p +DATA/asm/asmparameterfile/registry.253.744738853 -d +DATA
:sf480:~$srvctl config asm
ASM home: /u01/app/11.2.0.2/grid
ASM listener was not found
PRCA-1032 : ASM listener LISTENER does not exist
Spfile: +DATA/asm/asmparameterfile/registry.253.744738853
ASM diskgroup discovery string: +DATA
:sf480:~$
:sf480:~$
:sf480:~$srvctl status asm
ASM is not running.
:sf480:~$
:sf480:~$
:sf480:~$srvctl start asm
:sf480:~$
:sf480:~$
:sf480:~$srvctl status asm
ASM is running on sf480
:sf480:~$
:sf480:~$
:sf480:~$export ORACLE_SID=+ASM
+ASM:sf480:~$sqlplus "/as sysasm"
SQL*Plus: Release 11.2.0.2.0 Production on Mon Aug 22 16:48:49 2011

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Automatic Storage Management option

SQL> ALTER SYSTEM SET ASM_DISKGROUPS = 'DATA';

System altered.

SQL> ALTER DISKGROUP DATA MOUNT;

Diskgroup altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Automatic Storage Management option
+ASM:sf480:~$
+ASM:sf480:~$srvctl stop asm
PRCR-1065 : Failed to stop resource ora.asm
CRS-2529: Unable to act on 'ora.asm' because that would require stopping or relocating 'ora.DATA.dg', but the force option was not specified
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$srvctl stop asm -f
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$asmcmd
Connected to an idle instance.
ASMCMD> ls -l
ASMCMD-08102: no connection to ASM; command requires ASM to run
ASMCMD>
ASMCMD> exit
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$srvctl start asm
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$asmcmd
ASMCMD> ls -l
State Type Rebal Name
MOUNTED EXTERN N DATA/
ASMCMD>
ASMCMD> exit


4. Add listener component
This step should be performed as Grid Infrastructure owner (grid user).

+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$srvctl config listener
PRCN-2044 : No listener exists
+ASM:sf480:~$
+ASM:sf480:~$srvctl add listener -l LISTENER -p TCP:1521 -o /u01/app/11.2.0.2/grid
PRCN-2061 : Failed to add listener ora.LISTENER.lsnr
PRCN-2065 : Port(s) 1521 are not available on the nodes given
PRCN-2067 : Port 1521 is not available across node(s) "sf480.msk.vbrr.loc"
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$srvctl add listener -l LISTENER -s -p TCP:1521 -o /u01/app/11.2.0.2/grid
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$srvctl config listener
Name: LISTENER
Home: /u01/app/11.2.0.2/grid
End points: TCP:1521
+ASM:sf480:~$
+ASM:sf480:~$ps -ef|grep -i lsn
oragrid 2529 1151 0 16:53:20 pts/1 0:00 grep -i lsn
oragrid 1121 1 0 16:31:51 ? 0:01 /u01/app/11.2.0.2/grid/bin/tnslsnr LISTENER -inherit
+ASM:sf480:~$
+ASM:sf480:~$crsctl stat res -t
--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

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

Local Resources

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

ora.DATA.dg

               ONLINE  ONLINE       sf480

ora.LISTENER.lsnr

               OFFLINE OFFLINE      sf480

ora.asm

               ONLINE  ONLINE       sf480                    Started

ora.ons

               OFFLINE OFFLINE      sf480

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE       sf480

ora.diskmon

      1        ONLINE  ONLINE       sf480

ora.evmd

      1        ONLINE  ONLINE       sf480

+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'sf480'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'sf480'
CRS-2677: Stop of 'ora.DATA.dg' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'sf480'
CRS-2677: Stop of 'ora.asm' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'sf480'
CRS-2677: Stop of 'ora.cssd' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'sf480'
CRS-2677: Stop of 'ora.diskmon' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'sf480'
CRS-2677: Stop of 'ora.evmd' on 'sf480' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'sf480' has completed
CRS-4133: Oracle High Availability Services has been stopped.
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$crsctl stat res -t
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Status failed, or completed with errors.
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$asmcmd
Connected to an idle instance.
ASMCMD> ls -l
ASMCMD-08102: no connection to ASM; command requires ASM to run
ASMCMD> exit
+ASM:sf480:~$
+ASM:sf480:~$crsctl start has
CRS-4123: Oracle High Availability Services has been started.
+ASM:sf480:~$
+ASM:sf480:~$crsctl stat res -t
--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

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

Local Resources

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

ora.DATA.dg

               ONLINE  ONLINE       sf480

ora.LISTENER.lsnr

               ONLINE  ONLINE       sf480

ora.asm

               ONLINE  ONLINE       sf480                    Started

ora.ons

               OFFLINE OFFLINE      sf480

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE       sf480

ora.diskmon

      1        ONLINE  ONLINE       sf480

ora.evmd

      1        ONLINE  ONLINE       sf480

+ASM:sf480:~$
+ASM:sf480:~$asmcmd
ASMCMD> ls -l
State Type Rebal Name
MOUNTED EXTERN N DATA/
ASMCMD> exit
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$ps -ef|grep pmon
oragrid 2773 1 0 16:56:40 ? 0:00 asm_pmon_+ASM
oragrid 2837 1151 0 16:59:09 pts/1 0:00 grep pmon
+ASM:sf480:~$
+ASM:sf480:~$ps -ef|grep -i lsn
oragrid 2840 1151 0 16:59:27 pts/1 0:00 grep -i lsn
oragrid 1121 1 0 16:31:51 ? 0:01 /u01/app/11.2.0.2/grid/bin/tnslsnr LISTENER -inherit
+ASM:sf480:~$
+ASM:sf480:~$


5. Add database component
This step should be performed as RDBMS owner (oracle user).

:sf480:~$id
uid=102(oradb) gid=100(oinstall)
:sf480:~$srvctl config database -d catdb
PRCD-1120 : The resource for database catdb could not be found.
PRCR-1001 : Resource ora.catdb.db does not exist
:sf480:~$
:sf480:~$
:sf480:~$srvctl add database -d catdb -o /u01/app/oradb/product/11.2.0.2/dbhome_1 -p +DATA/catdb/spfilecatdb.ora -a DATA
:sf480:~$
:sf480:~$
:sf480:~$srvctl config database -d catdb
Database unique name: catdb
Database name:
Oracle home: /u01/app/oradb/product/11.2.0.2/dbhome_1
Oracle user: oragrid
Spfile: +DATA/catdb/spfilecatdb.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA
Services:
:sf480:~$
:sf480:~$
:sf480:~$srvctl status database -d catdb
Database is not running.
:sf480:~$
:sf480:~$
:sf480:~$srvctl start database -d catdb
:sf480:~$

+ASM:sf480:~$
+ASM:sf480:~$id
uid=701(oragrid) gid=100(oinstall)
+ASM:sf480:~$crsctl stat res -t
--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

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

Local Resources

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

ora.DATA.dg

               ONLINE  ONLINE       sf480

ora.LISTENER.lsnr

               ONLINE  ONLINE       sf480

ora.asm

               ONLINE  ONLINE       sf480                    Started

ora.ons

               OFFLINE OFFLINE      sf480

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

Cluster Resources

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

ora.catdb.db

      1        ONLINE  ONLINE       sf480                    Open

ora.cssd

      1        ONLINE  ONLINE       sf480

ora.diskmon

      1        ONLINE  ONLINE       sf480

ora.evmd

      1        ONLINE  ONLINE       sf480

+ASM:sf480:~$
+ASM:sf480:~$ps -ef|grep pmon
oragrid 2773 1 0 16:56:40 ? 0:00 asm_pmon_+ASM
oradb 3070 1 0 17:02:36 ? 0:00 ora_pmon_catdb
oragrid 3194 1151 0 17:05:16 pts/1 0:00 grep pmon
+ASM:sf480:~$

6. Restart HAS
+ASM:sf480:~$
+ASM:sf480:~$crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'sf480'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'sf480'
CRS-2673: Attempting to stop 'ora.catdb.db' on 'sf480'
CRS-2677: Stop of 'ora.catdb.db' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'sf480'
CRS-2677: Stop of 'ora.DATA.dg' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'sf480'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'sf480' succeeded
CRS-2677: Stop of 'ora.asm' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'sf480'
CRS-2677: Stop of 'ora.cssd' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'sf480'
CRS-2677: Stop of 'ora.diskmon' on 'sf480' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'sf480'
CRS-2677: Stop of 'ora.evmd' on 'sf480' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'sf480' has completed
CRS-4133: Oracle High Availability Services has been stopped.
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$crsctl stat res -t
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Status failed, or completed with errors.
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$crsctl start has
CRS-4123: Oracle High Availability Services has been started.
+ASM:sf480:~$
+ASM:sf480:~$crsctl stat res -t
--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS

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

Local Resources

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

ora.DATA.dg

               ONLINE  ONLINE       sf480

ora.LISTENER.lsnr

               ONLINE  ONLINE       sf480

ora.asm

               ONLINE  ONLINE       sf480                    Started

ora.ons

               OFFLINE OFFLINE      sf480

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

Cluster Resources

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

ora.catdb.db

      1        ONLINE  ONLINE       sf480                    Open

ora.cssd

      1        ONLINE  ONLINE       sf480

ora.diskmon

      1        ONLINE  ONLINE       sf480

ora.evmd

      1        ONLINE  ONLINE       sf480

+ASM:sf480:~$



7. Modify resource
+ASM:sf480:~$
+ASM:sf480:~$
+ASM:sf480:~$ps -ef|grep pmon
oragrid 3422 1 0 17:07:37 ? 0:00 asm_pmon_+ASM
oradb 3485 1 0 17:07:49 ? 0:00 ora_pmon_catdb
oragrid 3734 1151 0 17:13:37 pts/1 0:00 grep pmon
+ASM:sf480:~$
+ASM:sf480:~$crsctl stat res ora.catdb.db -p | grep AUTO_START
AUTO_START=restore
+ASM:sf480:~$crsctl modify resource ora.catdb.db -attr AUTO_START=always
+ASM:sf480:~$
+ASM:sf480:~$crsctl stat res ora.catdb.db -p | grep AUTO_START
AUTO_START=always
+ASM:sf480:~$