Thursday, September 20, 2012

Rename DB and DBID after refreshing on another server

Changing DB name & DBID using NID utility

[oracle@lnx-122 dbs]$ nid target=sys/abc123 dbname=cric
DBNEWID: Release 11.2.0.2.0 - Production on Thu Sep 20 09:40:32 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to database MAZE (DBID=1370075061)
Connected to server version 11.2.0
Control Files in database:
/u01/app/oracle/oradata1/cric/control01.ctl
/u01/app/oracle/oradata2/cric/control02.ctl
Change database ID and database name MAZE to CRIC? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1370075061 to 566499152
Changing database name from MAZE to CRIC
Control File /u01/app/oracle/oradata1/cric/control01.ctl - modified
Control File /u01/app/oracle/oradata2/cric/control02.ctl - modified
Datafile /u01/app/oracle/oradata2/cric/system01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata2/cric/sysaux01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata1/cric/undotbs01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata1/cric/users01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata1/cric/example01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata2/cric/appstbs_01.db - dbid changed, wrote new name
Datafile /u01/app/oracle/oradata1/cric/appstbs_01.db - dbid changed, wrote new name
Control File /u01/app/oracle/oradata1/cric/control01.ctl - dbid changed, wrote new name
Control File /u01/app/oracle/oradata2/cric/control02.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to CRIC.
Modify parameter file and generate a new password file before restarting.
Database ID for database CRIC changed to 566499152.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.

SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 20 09:41:20 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 331352984 bytes
Database Buffers 83886080 bytes
Redo Buffers 6086656 bytes
ORA-01103: database name 'CRIC' in control file is not 'MAZE'
 
SQL> shut immediate;
ORA-01507: database not mounted
 
ORACLE instance shut down.
SQL> exit

Since I didnt' make the changes to pfile & orapwd file the above error popped out. Make the changes in pfile & then set the right ORACLE_SID.  
[oracle@lnx-122 dbs]$ export ORACLE_SID=cric
[oracle@lnx-122 dbs]$ sql
SQL*Plus: Release 11.2.0.2.0 Production on Thu Sep 20 09:51:39 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
 --> start datbase with open resetlogs
SQL> alter database open resetlogs;
Database altered.
SQL> select name from v$database;
NAME
---------
CRIC
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oraredo/cric/redo03.log
/u01/app/oracle/oraredo/cric/redo02.log
/u01/app/oracle/oraredo/cric/redo01.log
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata1/cric/control01.ctl
/u01/app/oracle/oradata2/cric/control02.ctl
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata2/cric/system01.dbf
/u01/app/oracle/oradata2/cric/sysaux01.dbf
/u01/app/oracle/oradata1/cric/undotbs01.dbf
/u01/app/oracle/oradata1/cric/users01.dbf
/u01/app/oracle/oradata1/cric/example01.dbf
/u01/app/oracle/oradata2/cric/appstbs_01.dbf
/u01/app/oracle/oradata1/cric/appstbs_01.dbf
7 rows selected.

Note: Refer to oracle documention before using nid utility.

Wednesday, September 19, 2012

Incorrect password during Grid agent (OMA) installation

Installing agent an incorrect password was specified for agent resulted in OMA not being able to do a handshake with OMS

servvertst1:/app/oracle/product/agent11g/agent11g/bin-->./emctl status agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.
---------------------------------------------------------------
Agent Version : 11.1.0.1.0
OMS Version : 11.1.0.1.0
Protocol Version : 11.1.0.0.0
Agent Home : /app/oracle/product/agent11g/agent11g
Agent binaries : /app/oracle/product/agent11g/agent11g
Agent Process ID : 20447384
Parent Process ID : 23068916
Agent URL : http://servvertst1:3872/emd/main/
Repository URL : https://xx.xxx.xxx.xx:1159/em/upload/
Started at : 2012-09-18 16:07:44
Started by user : oracle
Last Reload : 2012-09-18 16:07:44
Last successful upload : (none)
Last attempted upload : (none)Total Megabytes of XML files uploaded so far : 0.00
Number of XML files pending upload : 417
Size of XML files pending upload(MB) : 18.89
Available disk space on upload filesystem : 18.80%
Last attempted heartbeat to OMS : 2012-09-19 16:37:18
Last successful heartbeat to OMS : unknown
---------------------------------------------------------------
Agent is Running and Ready
 
 
To resolve the issue follow the below steps
Go to grid_agent_home/bin

servvertst1:/app/oracle/product/agent11g/agent11g/bin-->./emctl unsecure agentOracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.
DelKeyWallet: Cannot open wallet. (error=28759):/app/oracle/product/agent11g/agent11g/sysman/config
clearsudoprops error: Could not delete key from wallet.
Checking Agent for HTTP... Done.
Agent is already unsecured.


Now we can assign the correct password

servvertst1:/app/oracle/product/agent11g/agent11g/bin-->./emctl secure agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.
Agent successfully stopped... Done.
Securing agent... Started.
Enter Agent Registration Password :specify_correct_passwd_here

Agent successfully restarted... Done.
Securing agent... Successful.

servvertst1:/app/oracle/product/agent11g/agent11g/bin-->./emctl status agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved.
---------------------------------------------------------------Agent Version : 11.1.0.1.0
OMS Version : 10.2.0.3.0
Protocol Version : 10.2.0.3.0
Agent Home : /app/oracle/product/agent11g/agent11g
Agent binaries : /app/oracle/product/agent11g/agent11g
Agent Process ID : 22282428
Parent Process ID : 18415688
Agent URL : https://servvertst1:3872/emd/main/
Repository URL : https://gridserver:1159/em/upload
Started at : 2012-09-19 16:40:34
Started by user : oracle
Last Reload : 2012-09-19 16:40:34
Last successful upload : 2012-09-19 16:41:03
Total Megabytes of XML files uploaded so far : 8.65
Number of XML files pending upload : 1
Size of XML files pending upload(MB) : 0.01

Available disk space on upload filesystem : 19.45%
Last successful heartbeat to OMS : 2012-09-19 16:40:40

---------------------------------------------------------------
Agent is Running and Ready



This indicates that OMA was able to do a handshake with OMS, once this is done you can go to grid control & add the new target