Comparing parameter files from two different databases.
In this article we will learn how to compare two parameter files from two different databases.
AIM :
To make changes on orcl to look like prod we need to follow below procedure
Source :
Server name : DBA1
instance name : prod
Target :
Server name : DBA2
instance name : orcl
Step 1 :
Check instance names from two databases
dba1 :
1 2 3 4 5 |
SYS>>select instance_name from v$instance; Inst-Name ---------- prod |
dba2 :
1 2 3 4 5 |
SYS>>select instance_name from v$instance; Inst-Name ---------- orcl |
Step 2 :
Create a listener or use existing listener at dba1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[oracle@dba1 ~]$ vi listener.ora pfile_list = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.51 )(PORT = 1565)) ) ) ) SID_LIST_pfile_list = (SID_LIST = (SID_DESC = (SID_NAME =prod) (ORACLE_HOME = /u01/app/oracle/product/12.1.0) ) ) |
Start the listener
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
[oracle@dba1 ~]$ lsnrctl start pfile_list LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 10-JAN-2019 22:41:42 Copyright (c) 1991, 2014, Oracle. All rights reserved. Starting /u01/app/oracle/product/12.1.0/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 12.1.0.2.0 - Production System parameter file is /home/oracle/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/dba1/pfile_list/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.51)(PORT=1565))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.51)(PORT=1565))) STATUS of the LISTENER ------------------------ Alias pfile_list Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production Start Date 10-JAN-2019 22:41:42 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /home/oracle/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/dba1/pfile_list/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.51)(PORT=1565))) Services Summary... Service "prod" has 1 instance(s). Instance "prod", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully |
Step 3 :
Create a dummy user with dba privileges
1 2 |
SYS>>grant dba to dup_user identified by dup_user; Grant succeeded. |
DBA2 SERVER(Target) :
Step 4 :
Create a TNSNAMES entry at dba2 Server
1 2 3 4 5 6 7 8 9 10 |
[oracle@dba2 ~]$ vi tnsnames.ora to_pfile_list = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.51)(PORT = 1565)) ) (CONNECT_DATA = (SID = prod) ) ) |
Step 5 :
Check tns pings with listener
1 2 3 4 5 6 7 8 |
[oracle@dba2 ~]$ tnsping to_pfile_list TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 10-JAN-2019 23:09:15 Copyright (c) 1997, 2014, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/12.1.0/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.51)(PORT = 1565))) (CONNECT_DATA = (SID = prod))) OK (10 msec) |
Step 6 :
Create database link and check connection established with another database or not ?
1 2 3 4 5 6 |
SYS>>create database link dblink_pfile connect to dup_user identified by dup_user using 'to_pfile_list'; Database link created. SYS>>select instance_name from v$instance@dblink_pfile; Inst-Name ---------- prod |
Step 7 :
Now create a table with all the parameters from dba server
1 2 |
SYS>>create table vin_param as select inst_id,name,value from gv$parameter@dblink_pfile; Table created. |
Step 8 :
Now differentiate parameters by using following query
1 2 3 4 5 6 7 8 9 |
set pages 300 lines 300 col prod for a45 col orcl for a45 select a.inst_id,a.name,b.value as prod ,a.value as orcl from gv$parameter a,(select inst_id,name,value from sys.vin_param) b where a.inst_id=b.inst_id and a.name=b.name and a.value<>b.value order by 1,2 |
The Result for the above query as follows
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
SYS>>get pfilechk.sql 1 select a.inst_id,a.name,b.value as prod, a.value as orcl from 2 gv$parameter a,(select inst_id,name,value from sys.vin_param) b 3 where a.inst_id=b.inst_id and 4 a.name=b.name and 5 a.value<>b.value 6* order by 1,2 7 / INST_ID NAME PROD ORCL ---------- ---------------------------------------- --------------------------------------------- --------------------------------------------- 1 audit_file_dest /u01/app/oracle/admin/prod/adump /u01/app/oracle/admin/orcl/adump 1 control_files /u01/app/oracle/product/12.1.0/prod/control01 /u01/app/oracle/oradata/orcl/control01.ctl, / .ctl, /u01/oradata/prod/fra/prod/control02.ct u01/app/oracle/fast_recovery_area/orcl/contro l l02.ctl 1 core_dump_dest /u01/app/oracle/diag/rdbms/prod/prod/cdump /u01/app/oracle/diag/rdbms/orcl/orcl/cdump 1 db_name prod orcl 1 db_recovery_file_dest /u01/oradata/prod/fra /u01/app/oracle/fast_recovery_area 1 db_unique_name prod orcl 1 dg_broker_config_file1 /u01/app/oracle/product/12.1.0/dbs/dr1prod.da /u01/app/oracle/product/12.1.0/dbs/dr1orcl.da t t 1 dg_broker_config_file2 /u01/app/oracle/product/12.1.0/dbs/dr2prod.da /u01/app/oracle/product/12.1.0/dbs/dr2orcl.da t t 1 dispatchers (PROTOCOL=TCP) (SERVICE=prodXDB) (PROTOCOL=TCP) (SERVICE=orclXDB) 1 instance_name prod orcl 1 memory_max_target 0 1660944384 1 memory_target 0 1660944384 1 pga_aggregate_target 828375040 0 1 result_cache_max_size 12517376 4161536 1 service_names prod orcl 1 sga_max_size 2499805184 1660944384 1 sga_target 2499805184 0 1 shared_pool_reserved_size 25165824 10905190 1 spfile /u01/app/oracle/product/12.1.0/dbs/spfileprod /u01/app/oracle/product/12.1.0/dbs/spfileorcl .ora .ora |
To have a better view you can check below screenshot
Before changing any parameter values in dba2 make sure you take back up of pfile of dba2
1 2 3 |
SQL> create pfile='/home/oracle/prod_pfile_jan09' from spfile; File created. |
To Make changes on dba2 to look like dba1 please run below commands
1 2 |
SYS>>alter system set pga_aggregate_target=828375040 scope=spfile sid='*'; SYS>>alter system set result_cache_max_size=12517376 scope=spfile sid='*'; |
In order to appear changes on orcl (dba2) bounce the database.
Thank you ……