Archive for February 2009

snmehl_connect and nmectla_agentctl

We got a page today from Grid Control saying that the agent on one of our database servers is unreachable but the host is up. Checking the agent, I found out that it wasn’t running at all. Restarted it but Oracle said it wasn’t ready. Looking at the trace file (ORA_AGENT_HOME/sysman/log/emdctl.trc), there was an entry with the following error:

2008-12-20 11:11:26 Thread-1 WARN http: snmehl_connect: connect failed to (database_server_name:3872): Connection refused (error = 146)
2008-12-20 11:11:26 Thread-1 ERROR main: nmectla_agentctl: Error connecting to https://:3872/emd/main/. Returning status code 1

So, with that, this is what I did:

1)/stop the db
2) stop the oms
3) start the db
4)start the the oms and
5)stop the agent delete all the files in the following directories
stop the agent AOH/bin/emctl stop agent

a) rm -rf /sysman/emd/agntstmp.txt
b) rm -rf /sysman/emd/upload/*
c) rm -rf /sysman/emd/recv/*
d) rm -rf /sysman/emd/state/*
e) rm -rf /sysman/emd/collection/*
f) rm -rf /sysman/emd/lastupld.xml

6) start the agent

If this doesn’t help you check in ORA_AGENT_HOME/sysman/config/emd.properties:
EMD_URL=https://:3872/emd/main/
- if port is free
- if in /etc/hosts is your server ( you can try IP address)

REPOSITORY_URL=https:///em/upload

agentTZRegion=UTC
- timezone must be the same as on server ( ckeck command date)

Regards,
Tom

Move a Database from using ASM to non-ASM Host using RMAN

SOURCE
1) Backup source database
rman target /
backup database plus archivelog delete input;
backup spfile include current controlfile format ‘/u02/orarestore/source_controlfile’;

2) Copy RMAN Backupsets to Destination Host

TARGET
3) Restore and Recover Destination Database

rman target /
startup nomount
restore spfile from ‘/u02/orarestore/source_controlfile’;

sqlplus / as sysdba
SQL> create pfile from spfile;

change parameters to new values.
This parameter are important:

*.control_files=’/u02/oradata/orcl/control01.ctl’,'/u02/oradata/orcl/control02.ctl’
*.db_create_file_dest=’/u02/oradata/orcl’
*.db_file_name_convert=’+ORCL_DATA1′,’/u02/oradata’
*.log_file_name_convert=’+ORCL_DATA1′,’/u02/oradata’

rman target /
restore controlfile from ‘/u02/orarestore/source_controlfile’;
alter database mount;
restore database;   —> to new location, you can check alert.log

4) Recover and Open the Database
sqlplus / as sysdba
recover database until cancel using backup controlfile;
alter database open resetlogs;

5) DONE

detailed steps are here

Regards,

Tom

Switchover trought Dataguard Broker (DGMGRL)

- I suppose you have set tnsname.ora, spfiles on both server and db are running
- first you must have standby redo log files on both db’s here

If you haven’t standby redo log file you get this error

Current status for “dbastby”:
Warning: ORA-16789: standby redo logs not configured

So how to set configuration
1) run DataGuard broker
dgmgrl

2) set primary db
CREATE CONFIGURATION DRSolution AS PRIMARY DATABASE IS dbaprim CONNECT IDENTIFIER IS dbaprim;

3) set stanby db
ADD DATABASE dbastby AS CONNECT IDENTIFIER IS dbastby MAINTAINED AS PHYSICAL;

4) enable confuguration
enable configuration

5) check if everything is ok
DGMGRL> show configuration

Configuration
Name:                drsolution
Enabled:             YES
Protection Mode:     MaxPerformance
Databases:
dbastby - Primary database
dbaprim - Physical standby database

Fast-Start Failover: DISABLED

Current status for “drsolution”:
SUCCESS

6) now you can switch to standby
DGMGRL> switchover to dbastby

7) switch back to primary db
DGMGRL> switchover to dbaprim
Performing switchover NOW, please wait…
New primary database “dbaprim” is opening…
Operation requires shutdown of instance “dbastby” on database “dbastby”
Shutting down instance “dbastby”…
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance “dbastby” on database “dbastby”
Starting instance “dbastby”…
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is “dbaprim”

8) You can check configuration
show database verbose ‘dbastby’;
show database verbose ‘dbaprim’;

or in sqlplus database role

select database_role from v$database;

Database dbaprim - PRIMARY
Database dbastby - PHYSICAL STANDBY

Regards,

Tom

TOPlist