Wednesday, September 17, 2014

Add, enable, disable service using srvctl

A brief post about add||enable||disable service using SRVCTL.

[oracle@oralab1 dbhome_1]$ srvctl config database  
 orcl  
 [oracle@oralab1 dbhome_1]$ srvctl config database -d orcl  
 Database unique name: orcl  
 Database name: orcl  
 Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1  
 Oracle user: oracle  
 Spfile: +DATA/orcl/spfileorcl.ora  
 Domain:  
 Start options: open  
 Stop options: immediate  
 Database role: PRIMARY  
 Management policy: AUTOMATIC  
 Database instance: orcl  
 Disk Groups: DATA  
 Services: 

--There is no any service(s).

--create new service:

SQL> begin  
  2 dbms_service.create_service('NEWORCL','NEWORCL');  
  3 end;  
  4 /  
 PL/SQL procedure successfully completed.  
 SQL> select name, enabled from dba_services;  
 NAME                               ENA  
 ---------------------------------  ---------------------------
 SYS$BACKGROUND                     NO  
 SYS$USERS                          NO  
 NEWORCL                            NO  
 orclXDB                            NO  
 orcl                               NO  

[oracle@oralab1 dbhome_1]$ srvctl config database -d orcl  
 Database unique name: orcl  
 Database name: orcl  
 Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1  
 Oracle user: oracle  
 Spfile: +DATA/orcl/spfileorcl.ora  
 Domain:  
 Start options: open  
 Stop options: immediate  
 Database role: PRIMARY  
 Management policy: AUTOMATIC  
 Database instance: orcl  
 Disk Groups: DATA  
 Services: NEWORCL  
 [oracle@oralab1 dbhome_1]$ srvctl status service -d orcl  
 Service NEWORCL is not running.  


--service is not started, let`s start

 SQL> exec dbms_service.start_service('NEWORCL');  
 PL/SQL procedure successfully completed.  
 SQL>

[oracle@oralab1 dbhome_1]$ srvctl status service -d orcl  
 Service NEWORCL is running  

 [oracle@oralab1 dbhome_1]$ srvctl config database -d orcl  
 Database unique name: orcl  
 Database name: orcl  
 Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1  
 Oracle user: oracle  
 Spfile: +DATA/orcl/spfileorcl.ora  
 Domain:  
 Start options: open  
 Stop options: immediate  
 Database role: PRIMARY  
 Management policy: AUTOMATIC  
 Database instance: orcl  
 Disk Groups: DATA  
 Services: NEWORCL  

--disable service
 [oracle@oralab1 dbhome_1]$ srvctl disable service -d orcl -s NEWORCL  

 [oracle@oralab1 dbhome_1]$ srvctl config service -d orcl  
 Service name: NEWORCL  
 Service is disabled  
 Cardinality: SINGLETON  
 Disconnect: false  
 Service role: PRIMARY  
 Management policy: AUTOMATIC  
 DTP transaction: false  
 AQ HA notifications: false  
 Failover type: NONE  
 Failover method: NONE  
 TAF failover retries: 0  
 TAF failover delay: 0  
 Connection Load Balancing Goal: LONG  
 Runtime Load Balancing Goal: NONE  
 TAF policy specification: NONE  
 Edition:  

 --Enable service  
 [oracle@oralab1 dbhome_1]$ srvctl enable service -d orcl -s NEWORCL  
 [oracle@oralab1 dbhome_1]$ srvctl config service -d orcl  
 Service name: NEWORCL  
 Service is enabled  
 Cardinality: SINGLETON  
 Disconnect: false  
 Service role: PRIMARY  
 Management policy: AUTOMATIC  
 DTP transaction: false  
 AQ HA notifications: false  
 Failover type: NONE  
 Failover method: NONE  
 TAF failover retries: 0  
 TAF failover delay: 0  
 Connection Load Balancing Goal: LONG  
 Runtime Load Balancing Goal: NONE  
 TAF policy specification: NONE  
 Edition:  

--You may stop/start services using SRVCTL utility too.

 -- stop service  
 [oracle@oralab1 dbhome_1]$ srvctl stop service -s NEWORCL -d orcl  
 [oracle@oralab1 dbhome_1]$ srvctl status service -d orcl  
 Service NEWORCL is not running. 

--start service  
 Services: NEWORCL  
 [oracle@oralab1 dbhome_1]$ srvctl start service -s NEWORCL -d orcl  
 [oracle@oralab1 dbhome_1]$ srvctl status service -d orcl  
 Service NEWORCL is running  

No comments:

Post a Comment

Cannot access dba_directories inside procedure

 Recently I faced one of familiar Oracle error ORA -00942 : table or view does not exist   I got it in while compiling procedure, becaus...