Wednesday, September 17, 2014

Forgot sysman password ?

Today I could not remember sysman password for database grid control. How carefully may I change sysman password ? Just follow.

1. Stop OMS (go to OMS dir)

 [oracle@gridrepo bin]$ ./emctl stop oms  
 Oracle Enterprise Manager 11g Release 1 Grid Control   
 Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.  
 Stopping WebTier...  
 WebTier Successfully Stopped  
 Stopping Oracle Management Server...  
 Oracle Management Server Successfully Stopped  
 Oracle Management Server is Down  

2. Config oms password with -change_repos_pwd parameter

[oracle@gridrepo bin]$ ./emctl config oms -change_repos_pwd  
 Oracle Enterprise Manager 11g Release 1 Grid Control   
 Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.  
 -change_in_db option not specified. Password not changed in backend.  
 Enter Repository User's New Password :   
 Updating repository password in Credential Store...  
 Repository password in Credential Store updated successfully.  
 Bounce the OMS.  
 Successfully changed repository password.  
 If you have multiple OMS's in your environment, run this command on all of them.  
 [oracle@gridrepo bin]$  

Or you can also use "-change_in_db" parameter with above command which is optional.

But be aware of prompt will ask you enter existing sysman password. Change sysman password by using tradional command:

 SQL> alter user sysman identified by new_pass;


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  

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...