Sunday, October 5, 2014

Oracle 11g Admin R2 - Chapter 04 Configuring Automatic Restart of an Oracle Database

- Determining the Oracle Home from which to Start SRVCTL:
 
1. Database, database service > Database home
$ . oraenv
ORACLE_SID = [+ASM] ? orcl

2. Oracle ASM instance, disk group, listener (as gird software was installed before database) , ONS
 
$ . oraenv
ORACLE_SID = [orcl] ? +ASM

- Obtaining Help for SRVCTL
 
$ srvctl -h

$ srvctl add -h

$ srvctl add service -h

- Adding Components with SRVCTL
 
- Create "sales" database with em repo

$ dbca -silent -createDatabase -characterSet AL32UTF8 -continueOnNonFatalErrors false -disableSecurityConfiguration ALL -emConfiguration local -gdbName sales.localdomain -listeners LISTENER -memoryPercentage 40 -sid sales -SysPassword oracle -SystemPassword oracle -sampleSchema true -templateName General_Purpose.dbc

- Add "sales" database to Oracle Restart (SRVCTL) components

$ srvctl add db -d dbcrm -o $ORACLE_HOME

- Add "servsales" services to Oracle Restart (SRVCTL) components

$ srvctl add serv -d dbcrm -s servdbcrm

- Adding the Default Listener

$ srvctl add listener


- Removing Components from the Oracle Restart Configuration
 
$ srvctl remove database -d sales

- To disable or enable automatic restart for a component:
 
$ srvctl disable database -d sales

$ srvctl enable database -d sales


- Viewing Component Status
 
$ srvctl status db -d orcl
Database is running.

- Viewing the Oracle Restart Configuration for a Component
 
$ srvctl config db -d orcl
Database unique name: orcl
Database name: orcl
Oracle home: /u01/app/oracle/product/11203/db_1
Oracle user: oracle
Spfile: $ORACLE_HOME/dbs/spfileorcl.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Database instance: orcl
Disk Groups: DATA,FRA
Services: orclsrv

- To modify the Oracle Restart configuration for a component:
 
$ srvctl modify database -d dbcrm -y MANUAL -s NOMOUNT
The management policy of services servdbcrm will be modified to MANUAL. Modify the management policy of the database dbcrm? (y/[n]) y
Modification of the database's management policy will be cancelled.

$ srvctl modify database -d dbcrm -y automatic -s open

- Setting Database Environment Variables
 
$ srvctl setenv database -d erphr -t "NLS_DATE_FORMAT='YYYY/MM/DD'"

$ srvctl getenv database -d erphr 
erphr:
NLS_DATE_FORMAT='YYYY/MM/DD'

- Creating and Deleting Database Services with SRVCTL
 
$ srvctl add service -d dbcrm -s servdbcrm

$ srvctl remove service -d dbcrm -s servdbcrm

$ srvctl add service -d dbcrm -s servdbcrm -l PHYSICAL_STANDBY

$ srvctl remove service -d dbcrm -s servdbcrm -f

- To enable FAN events in an Oracle Restart environment:
 
$ srvctl add ons$
$ srvctl start ons

- To start or stop a component managed by Oracle Restart with SRVCTL:
 
$ srvctl start database -d dbcrm

$ srvctl start database -d dbcrm -o nomount

$ srvctl start listener

$ srvctl start listener -l crmlistener

$ srvctl start service -d dbcrm -s "bizdev,support"

$ srvctl start diskgroup -g "data,fra"

$ srvctl stop database -d dbcrm

$ srvctl stop database -d dbcrm -o abort


- To disable and stop Oracle Restart, use the CRSCTL utility to run the following commands while installing a patch:
 
$ . oraenv
ORACLE_SID = [orcl] ? +ASM

$ crsctl disable has
CRS-4621: Oracle High Availability Services autostart is disabled.

$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'orcl1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'orcl1'
CRS-2673: Attempting to stop 'ora.erphr.db' on 'orcl1'
......

- To stop and start the components in an Oracle home while installing a patch:
 
$ srvctl stop home -o $ORACLE_HOME -s /usr1/or_state

$ srvctl start home -o $ORACLE_HOME -s /usr1/or_state

$ srvctl status home -o $ORACLE_HOME -s /usr1/or_state

No comments:

Post a Comment