Cloning a RAC Database May 20, 2010Posted by tamnau in General, RAC, RMAN.
Tags: ASM, Clone, Duplication, General, RAC, RMAN
Cloning a RAC Database may appear somewhat challenging, but its actually cloning a database as if it was a single instance and then enabling it as a cluster post to the duplication.
In the below scenario, I will demonstrate how this can be achieved by cloning a RAC database and have it manage by the same cluster. Please note that the following was tested for version 11.1 RAC with ASM.
The RAC configuration used for this example:
1. Log onto source RAC database:
[oracle@lnx01] export ORACLE_SID=SALT1; . oraenv [oracle@lnx01] sqlplus / as sysdba SQL> create pfile='/app/oracle/scripts/clone/initPEPPER.ora';
2. Edit /tmp/initPEPPER.ora and change the appropriate values.
Remove the following entries:
<SOURCE_INSTANCE1>.__db_cache_size=7650410496 <SOURCE_INSTANCE2>.__db_cache_size=7583301632 <SOURCE_INSTANCE1>.__java_pool_size=67108864 <SOURCE_INSTANCE2>.__java_pool_size=67108864 <SOURCE_INSTANCE1>.__large_pool_size=67108864 <SOURCE_INSTANCE2>.__large_pool_size=67108864 <SOURCE_INSTANCE1>.__oracle_base='/app/oracle' <SOURCE_INSTANCE2>.__oracle_base='/app/oracle' <SOURCE_INSTANCE1>.__pga_aggregate_target=6643777536 <SOURCE_INSTANCE2>.__pga_aggregate_target=6643777536 <SOURCE_INSTANCE1>.__sga_target=9462349824 <SOURCE_INSTANCE2>.__sga_target=9462349824 <SOURCE_INSTANCE1>.__shared_io_pool_size=0 <SOURCE_INSTANCE2>.__shared_io_pool_size=0 <SOURCE_INSTANCE1>.__shared_pool_size=1409286144 <SOURCE_INSTANCE2>.__shared_pool_size=1476395008 <SOURCE_INSTANCE1>.__streams_pool_size=134217728 <SOURCE_INSTANCE2>.__streams_pool_size=134217728
3. Adjust Memory Target accordingly for your environment
4. Set spfile parameter:
5. Disable the cluster_database parameter:
6. Create init parameter under dbs:
[oracle@lnx01] export ORACLE_HOME=/app/oracle/product/11.1 [oracle@lnx01] cd $ORACLE_HOME/dbs [oracle@lnx01] echo "SPFILE='+DG_DATA/PEPPER/spfilePEPPER.ora'" > $ORACLE_HOME/dbs/initPEPPER.ora
7. Edit initPEPPER.ora and add the following convert parameters:
8. Create the directories:
a) From one node only, create the ASM path for PEPPER database:
[oracle@lnx01] export ORACLE_SID=+ASM1; . oraenv [oracle@lnx01] asmcmd mkdir +DG_DATA/PEPPER [oracle@lnx01] asmcmd mkdir +DG_DATA/PEPPER/brsadata
b) From one node only, create the OS path for PEPPER admin directories:
[oracle@lnx01] mkdir -p /app/oracle/admin/PEPPER/adump [oracle@lnx01] mkdir -p /app/oracle/diag/rdbms/PEPPER/PEPPER1/cdump [oracle@lnx01] mkdir -p /app/oracle/diag/rdbms/PEPPER/PEPPER1/trace
c) Repeat step b on node 2 and other nodes in RAC:
[oracle@lnx02] mkdir -p /app/oracle/admin/PEPPER/adump [oracle@lnx02] mkdir -p /app/oracle/diag/rdbms/PEPPER/PEPPER2/cdump [oracle@lnx02] mkdir -p /app/oracle/diag/rdbms/PEPPER/PEPPER2/trace
9. Create a TNS entry for target auxiliary database and place in the tnsnames.ora. Add these entries on all nodes in cluster:
PEPPER = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = lnx01-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = lnx02-vip)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = PEPPER) ) ) LISTENERS_PEPPER = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = lnx01-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = lnx02-vip)(PORT = 1521)) ) LISTENER_PEPPER1 = (ADDRESS = (PROTOCOL = TCP)(HOST = lnx01-vip)(PORT = 1521)) LISTENER_PEPPER2 = (ADDRESS = (PROTOCOL = TCP)(HOST = lnx02-vip)(PORT = 1521))
10. If no listener.ora exists, create one as follows
# Node 1 LISTENER_lnx01 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = lnx01-vip)(PORT = 1521)(IP = FIRST)) (ADDRESS = (PROTOCOL = TCP)(HOST = 22.214.171.124)(PORT = 1521)(IP = FIRST)) ) ) # Node 2 LISTENER_lnx02 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = lnx02-vip)(PORT = 1521)(IP = FIRST)) (ADDRESS = (PROTOCOL = TCP)(HOST = 126.96.36.199)(PORT = 1521)(IP = FIRST)) ) )
11. Create an SPFILE from the parameter file, and start the auxiliary instance:
[oracle@lnx01] export ORACLE_HOME=/app/oracle/product/11.1 [oracle@lnx01] export ORACLE_SID=PEPPER SQL> CONNECT / as sysdba SQL> CREATE SPFILE='+DG_DATA/PEPPER/spfilePEPPER.ora' FROM PFILE='/app/oracle/scripts/clone/initPEPPER.ora'; SQL> STARTUP NOMOUNT;
12. Then run the following RMAN commands to duplicate the database:
[oracle@lnx01] rman target sysdba/<password>@SALT auxiliary / RMAN> DUPLICATE TARGET DATABASE TO 'PEPPER';
14. Add the entry for oratab file (located under /etc or /var/opt/oracle) for target auxiliary db:
a) Add in For node 1 oratab file:
b) Add in For node 2 oratab file:
15. Enable the cluster parameter in the target auxiliary database from one node only
[oracle@lnx01] export ORACLE_HOME=/app/oracle/product/11.1 [oracle@lnx01] export ORACLE_SID=PEPPER [oracle@lnx01] sqlplus / as sysdba SQL> alter system set cluster_database=TRUE scope=spfile; SQL> shutdown immediate;
16. Rename the init file and then copy the init file across to the
[oracle@lnx01] export ORACLE_SID=PEPPER1; . oraenv [oracle@lnx01] mv $ORACLE_HOME/dbs/initPEPPER.ora $ORACLE_HOME/dbs/initPEPPER1.ora [oracle@lnx01] scp $ORACLE_HOME/dbs/initPEPPER1.ora \ lnx02:/app/oracle/product/11.1/dbs/initPEPPER2.ora
17. Add the second thread of online redo logs and enable that thread;
18. Start up the second instance:
SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 5 '+DG_DATA' SIZE 250M reuse; SQL> ALTER DATABASE ADD LOGFILE MEMBER '+DG_REDO' TO GROUP 5 ; SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 6 '+DG_REDO' SIZE 250M reuse; SQL> ALTER DATABASE ADD LOGFILE MEMBER '+DG_DATA' TO GROUP 6; SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 7 '+DG_REDO' SIZE 250M reuse; SQL> ALTER DATABASE ADD LOGFILE MEMBER '+DG_DATA' TO GROUP 7; SQL> ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 8 '+DG_REDO' SIZE 250M reuse; SQL> ALTER DATABASE ADD LOGFILE MEMBER '+DG_DATA' TO GROUP 8; SQL> ALTER DATABASE ENABLE PUBLIC THREAD 2;
19. Stop all instances on each node for the target auxiliary database
a) From node 1 perform the following:
[oracle@lnx01] export ORACLE_SID=PEPPER1; . oraenv [oracle@lnx01] sqlplus / as sysdba SQL> shutdown immediate;
b) Then perform for other instances in the cluster:
[oracle@lnx01] export ORACLE_SID=PEPPER2; . oraenv [oracle@lnx01] sqlplus / as sysdba SQL> shutdown immediate;
20. To add into the cluster, add the new database to srvctl:
[oracle@lnx01] srvctl add database -d PEPPER -o /app/oracle/product/11.1 [oracle@lnx01] srvctl modify database -d PEPPER -p '+DG_DATA/PEPPER/spfilePEPPER.ora' -s open [oracle@lnx01] srvctl add instance -d PEPPER -i PEPPER1 -n lnx01 [oracle@lnx01] srvctl add instance -d PEPPER -i PEPPER2 -n lnx02
20. Start the RAC database
[oracle@lnx01] srvctl start database -d PEPPER
21. Now verify that the RAC database has now registered with the cluster.
For pre-11.2 run:
Or for 11.2 run:
crsctl stat res -t
EM Agent Mass Deployment May 10, 2010Posted by tamnau in RAC.
Tags: Enterprise Manager, Grid Control, RAC
1 comment so far
Recently I was asked, to post a topic on how to perform mass agent deployment using EM. So Chris, I am posting this one especially for you.
In the EM environment, agents play a very important role which allows communication between the target host and OMS (Oracle Management Server). The agent performs discovery of targets, monitoring, administering and uploading of information to the OMS. In some environments there can be up to hundreds if not thousands of agents required to be deployed to target hosts, hence there is a need to have options which allows such task to minimise manual intervention wherever possible.
First of all lets look at the different methods that are available for EM agent deployment:
a) Push Method – Interactive Installation via the EM Console (requires SSH user equivalence between OMS and target host)
b) Pull Method using wget – Silent installation with predefined downloadable script from OMS
c) NFS Agent –single Agent install on NFS file system shared between multiple hosts
d) OUI installer – Interactive installation method which requires X-session to be running
e) Agent Clone – Installing an agent using a copy of an existing agent home
Others may beg to differ, but from my experience if you have several hosts to deploy agents to, the Pull Method using wget can be quite effective. The other benefit is that you do not need to have X-session or SSH user equivalence setup.
In the below example, I will step through on how to stage the software on the OMS host, this needs to be done once and then the software can be re-used by other agent deployments. The second section will show how an EM agent can be deployed with few easy steps.
Stage Software on OMS host(s)
1. Download the agent software for mass deployment from the Oracle website:
2. Extract agent download software to each OMS host staging directory:
NOTE: If you have multiple OMS hosts, perform this on all hosts.
3. Update the values for OMS Host and Port in the response file for each OMS host:
The response file can be found in the filesystem of the OMS host at:
Pull Method using WGET
For today’s demo, I will show you the quickest deployment for agents with a few simple steps using the Pull Method.
1. Login to the target host that you wish to deploy the agent as oracle user:
2. If you have existing Oracle software deployed set the path to use the JDK under that directory:
[oracle@lnx01] export JDKHome=<JDK_BIN_PATH>
EXAMPLE: export JDKHome=/ora/app/oracle/product/11.1/rdbms/jdk/bin
3. Set the JDKHome in the current session’s PATH :
[oracle@lnx01] export PATH=$JDKHome:$PATH
[oracle@lnx01] wget http://<oms_host>:<oms_port>/agent_download/<version>/<os>/agentDownload.<os>
5. Set the execute permission for the agent download script
[oracle@lnx01] chmod +x agentDownload.<os>
EXAMPLE: chmod +x agentDownload.linux
6. Installation of agent can now proceed.
a) For agent deployments to a single node (standard), run:
[oracle@lnx01] ./agentDownload.<os_platform> -b <install_base_directory>
EXAMPLE:./agentDownload.linux -b /ora/app/oracle/product
b) For agent deployments to RAC nodes, run:
NOTE: Run this from one node only.
[oracle@lnx01] ./agentDownload.<os_platform> -b <install_base_directory> -n <cluster_name> -c <node1>,<node2>
EXAMPLE: ./agentDownload.linux -b /app/oracle/product -n racsos -c lnx01,lnx02
7. When prompted for Agent Registration password, specify one if required otherwise leave blank.
8. Upon completion, run the root.sh script as the super equivalent user.
9. Perform post verification that agent is running:
[oracle@lnx01] export ORACLE_HOME=<AGENT_ORACLE_HOME>
EXAMPLE: export ORACLE_HOME=/ora/app/oracle/product/agent10g
[oracle@lnx01] export PATH=$ORACLE_HOME/bin:$PATH [oracle@lnx01] emctl status agent
10. Validate that your agent has detected the targets on your host(s):
[oracle@lnx01] emctl config agent listtargets
11. Login to EM and configure your targets so it can be monitored via:
Enterprise Manager 10g – Useful Articles May 4, 2010Posted by sosdba in Uncategorized.
Tags: Enterprise Manager, Grid Control, Oracle
add a comment
Back in the days of working in Oracle Global Support, I had written some articles which assisted in resolving common issues or enquiries relating to EM. Below are just a some of the many articles which I had written, which I thought I would share.
For further information on these articles please log in to My Oracle Support web portal:
Grid Control – How to Setup User Privileges and Administration for Database Targets
How to Rename Cluster Target for RAC from Default ‘crs’ in Grid Control ?
How To Discover Cluster Target Types in Grid Control
DB Targets – Configuring SPFILE
Setting Up Out of Bound (OOB) Notification – “Enterprise Manager is Down”
Out-of-Bounds Notification “Enterprise Manager Repository database is down. Error 1017”
Problem Listener Not Discovering In Grid Control
Troubleshooting EM Agent or EMCA installation for RAC and Non-RAC environments
Trying to access Grid Console / DBConsole / Metric Browser shows “Certificate Errors”
Welcome to SOS DBA May 3, 2010Posted by sosdba in General.
Tags: General, Oracle
1 comment so far
I have been a DBA for over 9 years working at Telcos, Banking Institutions, Hosting companies and Oracle.
I never really thought about blogging about databases. But I am thinking what the heck?! All these years of googling and stumbling across blogs (posts) that were able to assist me in keeping my databases intact, I thought its my time to contribute back to the community and share my experiences with others. This blog will never be an “askTom.com” phenomenon but I hope it will be of use to someone out there wherever you are. Remember that I am still that someone too!!
Tam Nguyen (aka SOSDBA)