<title>Snapcopy DR to CC1</title>
<h3>Snapcopy DR to CC1</h3>
<xmp>
PR2 on sap0001
PR2-DR on sap0301
CC1 on sap0591
1) DBA Pre-refresh steps
as db2xxx user from $HOME/refresh directory
for Logistics (QLx) systems:
./exp_refresh_objects |tee exp_refresh_objects.log
b) Shutdown DB2 DB on systems being refreshed
###################################################################################
############################
This step is no longer required - JJC 11/30/2015
We will not be requesting any de-activation/activation of backup during refreshes
any longer
c) Enter Trouble Ticket to discontinue scheduled CV Hot backups on refreshed
systems to TEIS Backup Team
###################################################################################
############################
d) Comment out the crontab entries for CC1
2) Generate the relocate script on sap0001 as db2pr2
Note: Since PR2-DR is in Standby mode, brdb6brt needs to be run in production.
==============================================================================
On sap0001 as db2pr2
cd
brdb6brt -bm RETRIEVE_RELOCATE -replace PR2=CC1,db2pr2=db2cc1
scp -p PR2_NODE0000.scr db2cc1@sap0591:
Adjust the script on the Target site (sap0591)
LOG_DIR=/db2/PR2/log_dir/NODE0000/LOGSTREAM0000/,/db2/CC1/log_dir/NODE0000/LOGSTREA
M0000/
to
LOG_DIR=/db2/PR2/log_dir,/db2/CC1/log_dir
MIRRORLOG_PATH=/db2/PR2/log_dir2,/db2/CC1/log_dir2
3) SNAP PR2-DR UFSs to CC1
Verify HADR is active : db2pd -db $DB2DBDFT -hadr
Have the AIX Admins initiate the UFS snapshots from PR2-DR to CC1
Source: sap0301 Target: sap0591
------------------- -------------------
/db2/PR2/db2pr2 /db2/CC1/db2cc1
/db2/PR2/log_dir /db2/CC1/log_dir
/db2/PR2/log_dir2 /db2/CC1/log_dir2
/db2/PR2/sapdata1 /db2/CC1/sapdata1
/db2/PR2/sapdata2 /db2/CC1/sapdata2
/db2/PR2/sapdata3 /db2/CC1/sapdata3
/db2/PR2/sapdata4 /db2/CC1/sapdata4
/db2/PR2/sapdata5 /db2/CC1/sapdata5
/db2/PR2/sapdata6 /db2/CC1/sapdata6
/db2/PR2/sapdata7 /db2/CC1/sapdata7
/db2/PR2/sapdata8 /db2/CC1/sapdata8
/db2/PR2/sapdata9 /db2/CC1/sapdata9
/db2/PR2/sapdata10 /db2/CC1/sapdata10
/db2/PR2/sapdata11 /db2/CC1/sapdata11
/db2/PR2/sapdata12 /db2/CC1/sapdata12
/db2/PR2/sapdata13 /db2/CC1/sapdata13
/db2/PR2/sapdata14 /db2/CC1/sapdata14
/db2/PR2/sapdata15 /db2/CC1/sapdata15
/db2/PR2/sapdata16 /db2/CC1/sapdata16
When the snaps are ready: Shutdown PR2-DR
a) shutdown_DB2
b) Finalize the UFS Snapshots
#c) SCP /db2/PR2/db2pr2/NODE0000 from PR2-DR to CC1
# scp -rp /db2/PR2/db2pr2/NODE0000 db2cc1@$sap0591:/db2/CC1/db2cc1/
# ( Possibly make this a separate UFS 1GB and snap it in the future )
d) * verify the UFS sizes on CC1
e) Split the mirror
Restart the standby on the DR Server (wait until refreshed DB has been opened
successfully)
db2start
db2 start hadr on database ${DB2DBDFT} as standby
db2pd -db ${DB2DBDFT} -hadr
4) Change file Owners on CC1 (as root)
CC1
SID=CC1
sid=`echo ${SID}| awk '{ print tolower($0)}'`
OLD_SID=PR2
old_sid=`echo ${OLD_SID}| awk '{ print tolower($0)}'`
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
find /db2/${SID}/sapdata${i} | grep -v "lost+found" | xargs chown db2$
{sid}:db${sid}adm
done
for i in log_dir log_dir2 db2${sid}
do
find /db2/${SID}/${i} | grep -v "lost+found" | xargs chown db2${sid}:db$
{sid}adm
done
5) Rename UFSs on CC1 (as root continued )
CC1
for i in `find /db2/${SID} -name db2${old_sid}`
do
echo $i | awk '{ new=$0
sub(/pr2/,"cc1",new)
printf "mv %s %s\n",$1,new }'
done
for i in `find /db2/${SID} -name ${OLD_SID}`
do
echo $i | awk '{ new=$0
sub(/PR2/,"CC1",new)
printf "mv %s %s\n",$1,new }'
done
6) Create soft link sapcc1 (as root)
cd /db2/PR2
ln -s /db2/CC1/db2dump/PR2/log_archive2
7) Create directory structures from above command sets (as db2xxx)
cd /db2/CC1/db2dump
mkdir PR2
cd PR2
mkdir log_archive2
8) Run db2inidb and finish the rollforward on CC1/QS1 (as db2xxx)
for CC1
db2start
db2inidb CC1 as snapshot relocate using PR2_NODE0000.scr
Relocating database...
Files and control structures were changed successfully.
Database was catalogued successfully.
DBT1000I The tool completed successfully.
Database relocation was successful.
DBT1008N Database "CC1" is not a split mirror image.
9) Disable the Standby setting in CC1
db2 update db cfg for $DB2DBDFT using BLOCKNONLOGGED NO immediate
db2 update db cfg for $DB2DBDFT using LOGINDEXBUILD OFF immediate
db2 update db cfg for $DB2DBDFT using HADR_LOCAL_HOST NULL
db2 update db cfg for $DB2DBDFT using HADR_LOCAL_SVC NULL
db2 update db cfg for $DB2DBDFT using HADR_REMOTE_HOST NULL
db2 update db cfg for $DB2DBDFT using HADR_REMOTE_SVC NULL
db2 update db cfg for $DB2DBDFT using HADR_REMOTE_INST NULL
db2 update db cfg for $DB2DBDFT using HADR_TIMEOUT 120
db2 stop hadr on database $DB2DBDFT
db2pd -db ${DB2DBDFT} -hadr
10) Reconfigue CV for CC1/QS1
CVNAME=SAPCC1-AIX
db2 update db cfg for ${DB2DBDFT} using VENDOROPT "'CvClientName=$
{CVNAME},CvInstanceName=Instance001'"
db2 update db cfg for ${DB2DBDFT} using LOGARCHOPT1 "'CvClientName=$
{CVNAME},CvInstanceName=Instance001'"
db2 update db cfg for ${DB2DBDFT} using LOGARCHMETH1
VENDOR:/opt/cvlt/simpana/Base64/libDb2Sbt.so
db2 update db cfg for ${DB2DBDFT} using LOGARCHCOMPR1 ON
db2 "update db cfg for ${DB2DBDFT} using OVERFLOWLOGPATH /db2/$
{DB2DBDFT}/log_retrieve immediate"
db2stop
db2start
10a) Temporary step for CC1 only - change the logprimary and logsecondary counts
before the rollforward.
db2 update db cfg for ${DB2DBDFT} USING LOGPRIMARY 40
db2stop
db2start
db2 update db cfg for ${DB2DBDFT} USING LOGSECOND 40
db2stop
db2start
10b) Temporary step for CC1 only - remove the mirrorlog to speed up the rollforward
process.
db2 update db cfg for ${DB2DBDFT} using MIRRORLOGPATH DEFAULT
11) Finish the rollfoward, finish the log configuration
db2 rollforward database $DB2DBDFT complete
DB20000I The ROLLFORWARD command completed successfully.
Verify the log size, resize if needed
( db2 connect to $DB2DBDFT
printf "Description Parameter Current
Value Delayed Value\n"
printf
"----------------------------------------------------------------------------------
-----------------------------\n"
db2 get db cfg for $DB2DBDFT show detail | grep LOGFILSIZ
)
for CC1
db2 update db cfg for ${DB2DBDFT} USING LOGFILSIZ 524288
for all
db2 update db cfg for ${DB2DBDFT} using LOGARCHMETH2 OFF
db2 update db cfg for ${DB2DBDFT} using LOGARCHOPT2 OFF
db2 update db cfg for ${DB2DBDFT} using LOGARCHCOMPR2 OFF
shutdown_DB2
startup_DB2
12) Set Instance Memory
set_mem # a function defined in ~/.functions
Make sure $CONFIG/db_specific_${DB2DBDFT}.sh matches this setting
13) update groups SYS groups if needed
db2 get dbm cfg | grep -i "group name"
SYSADM group name (SYSADM_GROUP) = DBPR2ADM
SYSCTRL group name (SYSCTRL_GROUP) = DBPR2CTL
SYSMAINT group name (SYSMAINT_GROUP) = DBPR2MNT
SYSMON group name (SYSMON_GROUP) = DBPR2MON
db2 update dbm cfg using SYSADM_GROUP DB${DB2DBDFT}ADM immediate
db2 update dbm cfg using SYSCTRL_GROUP DB${DB2DBDFT}CTL immediate
db2 update dbm cfg using SYSMAINT_GROUP DB${DB2DBDFT}MNT immediate
db2 update dbm cfg using SYSMON_GROUP DB${DB2DBDFT}MON immediate
14) update security settings, Change ownership of DB2 tables: on CC1 as db2pr2
###### One time setup only ######################################
#
# smitty user # to add/adjust the account
#
# After the password is updated, be sure to update
#
# vi /etc/security/passwd
#
# db2xxx:
# password =
{ssha512}06$fSxV7q2nkMF/kgFH$ctSPWxgFTXp4QYPqohXs1/MWx29l8nrAXueQn2nZ07TycSdW4lPNal
r075HDoLFF2hzIZlalSc33q683RyyL..
# lastupdate = 1354654922
# -> remove flags = ADMCHG
# -> insert if needed flags = NOCHECK
# CC1
#
# * The db2pr2 AIX account needs to be created on sap0591
#
# User NAME : db2pr2
# User ID : 60018
# Primary Group : dbcc1adm
# Group SET : dbcc1adm,sapinst,sapsys,dbcc1mnt
# HOME directory : /db2/db2pr2
# Initial PROGRAM : /usr/bin/ksh
#
# set the password to 0myG...
#######################################################################
su - db2pr2
.profile
PATH=$PATH:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/ccs/bin:/usr/ucb:/usr/local/bin:/et
c:/opt/perf/bin:/usr/contrib/bin:.:/db2/db2cc1/db2_software/bin:/db2/db2cc1/db2sa/b
in:/db2cc1/db2sa/scripts
export PATH
db2 -t
connect to CC1;
grant dbadm , secadm, sqladm, wlmadm on database to user db2cc1;
grant dbadm on database to user cc1adm;
select substr(grantor,1,10) as grantor,grantortype,substr(grantee,1,15)
as grantee, granteetype,
substr(rolename,1,30) as rolename, roleid, admin from sysibm.sysroleauth;
quit;
Change ownership of DB2 tables ( as db2pr2 on CC1 )
for CC1
db2 connect to CC1
db2 "select substr(TABSCHEMA,1,10) as tabschema,substr(owner,1,10) as
owner,substr(TABNAME,1,40) as tabname
from syscat.tables where OWNER in ('DB2PR2') order by tabname"
db2 connect to CC1
db2 -t "select substr('db2 \"transfer ownership of '||case when type='T' then
'TABLE ' when type='V' then 'VIEW ' end||
rtrim(tabschema)||'.'||rtrim(TABNAME)||' to user db2cc1 preserve
privileges\"',1,132)
from syscat.tables where OWNER in ('DB2PR2') and TYPE in ('T','V')
order by type,tabschema,tabname;"
Under the configuration drop down, there is Data Collection Framework.
That gives two options, select Collector Configuration. You then have to
click on each Data Collector
to update the collection interval. I matched the intervals to the same ones
on CC1.
15) Rebind (as db2xxx)
cd $BIN
for i in `ls -1 *.bnd`
do
db2 bind ${i} ACTION REPLACE OWNER `whoami` COLLECTION db2dba
done
16) Parameter settings did not copy : CHECK ON THIS ....
set SAP 10.1 parameters
cd $CONFIG
config.sh
check clean
db2set DB2_USE_ALTERNATE_PAGE_CLEANING=ON
check clean
shutdown_DB2
startup_DB2
17) rename tablespaces and update tablespaces in virtual table views on CC1
db2 update db cfg for $DB2DBDFT using CATALOGCACHE_SZ 40000 immediate
CC1
cd to $HOME/refresh
db2 -t "select substr('db6util -rtvt '||tbsp_name||' CC1#'||
substr(tbsp_name,5,length(tbsp_name)-4),1,80)
from sysibmadm.tbsp_utilization where tbsp_name like 'PR2#%' order by
tbsp_name;" > $HOME/refresh/update_virtual_tables
./Step_15_tablespace_rename.sql
Make sure the final result is 0 rows. The following SQL is executed at the
end:
db2 -t "select substr('db2 rename tablespace '||tbsp_name||' to CC1#'||
substr(tbsp_name,5,length(tbsp_name)-4),1,80)
from sysibmadm.tbsp_utilization where tbsp_name like 'PR2#%' order by
tbsp_name;"
Open several windows to submit several virtual table renames at once. The
commands are in the file $HOME/refresh/update_virtual_tables.
Make sure to group both the data and index tablespaces when running the
updates. Run the POOLD and POOLI tablespaces first.
The commands will look like this:
db6util -rtvt PR2#BTABD CC1#BTABD
db6util -rtvt PR2#BTABI CC1#BTABI
18) update SAP catalog entries
CC1
In the $HOME/refresh directory. Run the following three scripts in any order
and verify the output:
./Step_16_tsdb6_cleanup.sql
./Step_16_tadb6_cleanup.sql
./Step_16_iadb6_cleanup.sql
They run the following SQL:
db2 "create table sapr3.tsdb6_save as (select * from sapr3.tsdb6) definition
only"
db2 "insert into sapr3.tsdb6_save select * from sapr3.tsdb6"
db2 -t "update sapr3.tsdb6 set
tabspace = 'CC1#'||substr(tabspace,5,length(tabspace)-4),
indspace = 'CC1#'||substr(indspace,5,length(indspace)-4)
where substr(tabspace,1,4) = 'PR2#';"
db2 "select distinct substr(tabspace,1,15) as tabspace,substr(indspace,1,15)
as indspace from sapr3.tsdb6 order by 1"
db2 "create table sapr3.iadb6_save as (select * from sapr3.iadb6) definition
only"
db2 "insert into sapr3.iadb6_save select * from sapr3.iadb6"
db2 -t "update sapr3.iadb6 set
tabspace = 'CC1#'||substr(tabspace,5,length(tabspace)-4)
where substr(tabspace,1,4) = 'PR2#';"
db2 select distinct tabspace from sapr3.iadb6 order by tabspace
db2 "create table sapr3.tadb6_save as (select * from sapr3.tadb6) definition
only"
db2 "insert into sapr3.tadb6_save select * from sapr3.tadb6"
db2 -t "update sapr3.tadb6 set
tabspace = 'CC1#'||substr(tabspace,5,length(tabspace)-4)
where substr(tabspace,1,4) = 'PR2#';"
db2 select distinct tabspace from sapr3.tadb6 order by tabspace
20) Review the Post conversion steps/ DBA Team Post work
as db2xxx user from $HOME/refresh directory
For Logistics (QLx) systems:
a) Run scripts to truncate and import saved tables:
materialize_virtual_tables | materialize_virtual_tables.log
truncate_objects |tee truncate_objects.log
import_refresh_objects |tee import_refresh_objects.log
b) Before running updates, set the num_log_span to 0 and LOGSECOND to 160 for
the updates:
db2 connect
db2 update db cfg for ${DB2DBDFT} USING NUM_LOG_SPAN 0 immediate
db2 get db cfg for $DB2DBDFT show detail | grep NUM_LOG_SPAN
db2 update db cfg for ${DB2DBDFT} USING LOGSECOND 160
db2 get db cfg for $DB2DBDFT show detail | grep LOGSECOND
Open three windows and run the following sql:
db2 -tvf update1.sql |tee update1.log
db2 -tvf update2.sql |tee update2.log
db2 -tvf update3.sql |tee update3.log
c) Set the mirrlog destination and do the required database bounce before
starting the NAST update:
db2 update db cfg for ${DB2DBDFT} USING MIRRORLOGPATH /db2/$
{DB2DBDFT}/log_dir2
shutdown_DB2
startup_DB2
d) Run the nast update:
nast_update.sql |nast_update.log
e) After NAST update has finished, set num_log_span back to 20 and logsecond
back to 40:
db2 connect
db2 update db cfg for ${DB2DBDFT} USING NUM_LOG_SPAN 20 immediate
db2 get db cfg for $DB2DBDFT show detail | grep NUM_LOG_SPAN
db2 update db cfg for ${DB2DBDFT} USING LOGSECOND 40
db2 get db cfg for $DB2DBDFT show detail | grep LOGSECOND
21) Verify logprimary and logsecond counts and update if needed
log_config
logprimary should be 40
For Logistics (CLx) systems:
logsecond should be 40
If changes needed for either:
db2 update db cfg for ${DB2DBDFT} USING LOGPRIMARY 40
shutdown_DB2
startup_DB2
For Logistics (CLx)
db2 update db cfg for ${DB2DBDFT} USING LOGSECOND 40
shutdown_DB2
startup_DB2
log_config (to verify the changes)
Count the actual logs on the system (should be 40) - cycle again if needed.
find_logs | grep "\.LOG"| wc -l
###################################################################################
############################
This step is no longer required - JJC 11/30/2015
We will not be requesting any de-activation/activation of backup during refreshes
any longer
22) Enter Trouble Ticket to continue scheduled CV Hot backups on refreshed systems
to TEIS Backup Team (specify date on when they should once again start)
###################################################################################
############################
23) Backup the DB
24) UN-Comment out crontab entries for CC1
and then activate the crontab jobs as db2$sid
crontab /var/spool/cron/crontabs/db2${sid}
25) After systems have been turned over to users, go into DBACOCKPIT and set up the
REORGCHK job to run on Sundays at noon.
a) sign onto SAP for that system and run the DBACOCKPIT transaction.
b) if given the option at the main screen, choose sapgui for the display
c) expand the Jobs tab on the left side of screen
d) double click on the "DBA Planning Calendar" option
e) on the top right hand side of the screen will be a box titled "Action Pad".
Scroll down to the "REORGCHK for all Tables" choice and double click it.
f) a window will pop up. clock on the tab titled Recurrence.
g) on that screen, under Recurrence Pattern, select Week(s) and make sure only
Sunday is checked.
h) under Recurrence Range, the start date should be the following Sunday. If
it isn't, correct it.
i) At the top of the screen, set the time to 12:00:00 and press enter.
j) If all looks right, click the Add button at the bottom of the screen to
schedule the job.
k) This will take you back to the DBA Planning Calendar screen. Refresh the
screen and verify the job is scheduled to run on the next Sunday.