Showing posts with label MSSQL. Show all posts
Showing posts with label MSSQL. Show all posts

Operating System and Database Migration

Pre Export Process In Application level :- 


  • Check the Java JRE version (Min 1.4.1).
  • Check the QCM table entries of SAP.
  • Check for cancelled and update task
  • Delete table entries from TATGPC, TATGPCA
  • Check the incremental table conversion
  • Cancel all released jobs
  • Check for the operation modes
  • Delete unnecessary spool data
  • De-schedule all SAP jobs
  • Delete all the batch jobs
  • Release all repairs and correction and transports
  • delete background input logs
  • Delete job logs
  • Delete the tRFC
  • Check for the code pages installed
  • Check the DDIC password for 000 client


Pre Export Process In OS level :-

  • Deschedule all OS DB backups
  • Shutdown all external interface
  • The source should have minimum SP3


Pre Export Process In DB level :-


  • Update DB statistics
  • Change the DB to no archive log mode


Steps to Start the DB export


  • Enter the system as adm
  • Create to directory in the source system eg, Export, Install
  • Check for the PSAPTEMP, the size should be 2 times the largest index 
  • Start the R3setup.bat program from the kernel CD (use the 45B_EXT kernel cd for the migration as the target system is AIX 5.3, always check the PAM before using the kernel cd.)
  • Edit the DBEXPORT.R3S file and skip the update of statistics as it is already done and update statistics of R3SETUP is high time consuming. It can even run for days for a DB size more than 1 TB
  • Edit the DBEXPORT.R3S to stop for splitter
  • Start the export
  • The export stops at the given breakpoint for the splitter
  • Split the STR files generated
  • Repeat the export process



Import process


  • Check the Java version ( Minimum JRE version 1.4.1 )
  • Check all necessary drives and filesystems. ( #mkdir /oracle/client/92x_64, # cd /oracle/stage, #mkdir 920_64 )
  • Create to directory eg, Install, Import
  • From install directory run instool.sh of Ext. kernel cd for AIX.
  • set environment.
  • #csh
  • #setenv LIBPATH /sapmnt//exe:/oracle//920_64/lib.
  • Install the central instances. R3SETUP –f CENTRAL.R3S
  • In the next installation process choose “Exit”
  • Install Oracle software as per WAS640 guide with ora user.
  • After the oracle installation is done repeat the installation of the R3SETUP
  • The R3SETUP stops for Migration key check phase
  • Create the tablespaces of the required sizes
  • Restart the database in no archive log mode
  • Start the import process
  •  Complete the post installation steps from the migration guide of 45 B



Some of the problems faced with the above mentioned source and target system


  • During the export phase after the STR files are created the export stops with an error saying 

“Cannot connect to DB”

Solution: Delete the following R3load, R3szchk, R3ldctl from the Instal directory.


  •  Use update of DB statistics by sapdba or brtools. Avoid using the update of statistics by the export

Process

Solution: Edit the DBEXPORT.R3S file and delete the lines DBCOMPUTESTAT4MIG_XT*,
DBCOMPUTESTAT4MIG*, BRCONNECTEXPSTAT*


  •  Export takes a huge time


Solution: Use the java based package splitter to split the STR files for the export.


  •  Export fails complaining the PSAPTEMP size is small.


Solution: Check the size of the PSAPTEMP before export. It should be atleast 2 times the size of the largest index for R/3.


  • During the import process check the aio settings in the OS level.


Solution: We have used the mix server of 512 and max server of 1024 during the import process


  • 6. The import process fails due to lack of space to extend the extent at PSAPROLL


Solution: Try using the PSAPUNDO in place of PSAPROLL


  • 7. The total system downtime could be reduced if MIGMON was used. The firewall rule prevented 

from the use of migmon between the source and the target.


Post Installation jobs for BASIS area


  •  Replace the disp+work of the kernel.
  •  Delete the table entries as mentioned in the Heterogeneous system copy guide of 45B
  • Edit the RFC destination address of other connected system.    
  •  Change the printer definition of the target. Test all the printers are working or we need to make changes in the settings.
  •  Set up the TMS
  • Check for the ALE and IDOCS flow after the new system is up
  •  Schedule all the basic BASIS background jobs.
  •  Take a full offline backup



Reason for moving to Oracle 9.2.0.7

9.2.0.4 being the first stable release of R/3 had many bugs which are listed in the SAP and Oracle sites were later removed in later subsequent releases.

This oracle will be upgraded to Oracle 10.2.0.2 and for the upgrade the source should be at oracle 9.2.0.7 before it can be upgraded to 10g. 

As we go higher up in the in the Optimizer gets improved hence the execution plans are improved and this results is transactions executing faster

Using of the Package splitter

The java based package splitter can be used to split the STR files

  •  Open new terminal preparation for splitter tool.
  •  Edit packet_splitter_end.properties file 
  •  Use splitter guide for clarification.
  •  setenv JAVA_HOME /usr/opt/java141.
  •  using adm user, start split process.

DB2 Utility Commands

DB2 Utility Commands
List the running utilities and their progress

db2 list utilities show detail
Throttle a running utility.
First find the Utility ID.
db2 list utilities show detail
Throttle the utility to a value of 1 to 10. 10 being the most throttled.

db2 set UTIL_IMPACT_PRIORITY for <util_id> TO 5

DB2 Tuning Commands

DB2 Tuning Commands


Quickly look at some basic tuning measurements
db2 "select db_name, rows_read, rows_selected, lock_waits, lock_wait_time, deadlocks, lock_escals, total_sorts, total_sort_time from table (snapshot_database (' ', -1) ) as snapshot_database"



DB2 Tablespace and Bufferpool Commands

DB2 Tablespace and Bufferpool Commands


View the names, pagesize, and number of pages of the bufferpools in your database
db2 "select bpname,pagesize,npages from syscat.bufferpools"
Make a bufferpool resize automatically. You must have STMM turned on at the database configuration level
db2 alter bufferpool bp1 size AUTOMATIC
Alter a bufferpool size that is a fixed size
db2 ALTER BUFFERPOOL IBMDEFAULTBP SIZE 15000;
Add space to a DMS tablespace

db2 "alter tablespace <tblspace> extend (all 8000)"

DB2 Table and Index Commands

DB2 Table and Index Commands

Look at columns and data types of a table
db2 describe table schema.tabelename
Look at one column's data type.
db2 "describe select <colname> from schema.tablename"
Look at indexes on a table
db2 describe indexes for table schema.tablename
Export data to a file in ixf format
db2 export to tablename.ixf of ixf messages tablename.txt select * from SCHEMA.TABNAME
Import data from an ixf file
db2 import from filename.ixf of ixf messages tablename.txt insert into SCHEMA.TABNAME
Import using Load which is faster (doesn't check constraints) and NONRECOVERABLE doesn't log anything
db2 load from filename.ixf of ixf insert into SCHEMA.TABNAME nonrecoverable;
Build a file to set integrity on all tables that are in set integrity pending state

db2 "select 'set integrity for '||tabschema||'.'||tabname ||' immediate checked;' from syscat.tables where type = 'T' and status = 'C'" > file.out

DB2 Security Commands

DB2 Security Commands

Build a script to grant user execute privilege on all packages.
db2 "select 'db2 grant execute on package '||pkgschema||'.'||pkgname||' to user <user>;' from syscat.packages where pkgschema = 'NULLID'" > output.file

Security Notes
dbadm auth must be revoked before any other database privlege

create_not_fenced_routine must be revoked before create_external_routine

DB2 Backup and Restore Commands

DB2 Backup and Restore Commands

Take an OFFLINE backup
db2 connect to <dbname>
db2 quiesce database immediate force connections
db2 connect reset
db2 backup database <dbname> to <path> compress without prompting
after backup completes:
db2 connect to <dbname>
db2 unquiesce database
db2 connect reset
Take an ONLINE Backup
db2 backup db <dbname> to <path> online compress
or use a background process on a linux/unix machine
nohup db2 backup db <dbname> to <path> online compress &
List recent backups and where they are stored
db2 list history backup all for <dbname>
Check the integrity of a backup image
db2ckbkp <image name>
Restore from Incremental Backup Automatic
db2 restore db <dbname> incremental automatic taken at <timestamp>
If you need to restore an incremental backup manually this command will give you the required previous backups.

db2ckrst -d <dbname> -t <timestamp of image>

DB2 Commands Home

Basic Commands
Size of your database : 
db2 'call get_dbsize_info(?,?,?,0)'
Version of DB2 you are running:
db2level
Stop the db2 instance:
db2stop
Stop an instance that has current connections
db2 force applications all
db2 deactivate db <dbname>
db2 terminate
db2stop force
ipclean
Start the db2 instance:
db2start
Kill a hung instance (last resort):
db2_kill -all
List the databases in an instance:
db2 list db directory
List the cataloged nodes:
db2 list node directory
Show the database manager configuration settings:
db2 get dbm cfg
Show the database level configuration settings:
db2 get db cfg for <dbname>
Activate a database:
db2 activate db <dbname>
Deactivate a database:
db2 deactivate db <dbname>
View the DB2 License:
db2licm -l
To switch between partitions: 
db2 terminate; export DB2NODE=<new-node-num>

New Forum Saptecharena

DB Refresh Steps in SAP

PROCEDURE FOR DB REFRESH:

1)      Take full offline backup of database using BRTOOLS/DB13.
Brbackup –u –p init<sid>.sap –d disk –t offline –m all
2)      Generate the control file
SQL> alter database backup controlfile to trace;
Get the trace file from user trace directory and modify the file as following
  1.    Rename the file to control.sql.
  2.  Remove all the content above the line  STARTUP NOMOUNT and below CHARACTER SET URF8;
  3.    Replace NORESETLOGS with RESETLOGS.
  4.    Replace ARCHIVELOG with NOARCHIVELOG.
  5.    Replace S_sid with T_sid.
3)      Change the S_sid with T_sid in b***.afd backup log file.
4)      Change the S_sid with T_sid  in the first file of backup folder and rename to target sid.
5)      Restore the database using the command
Brrestore –u 0b b***.afd -d disk –k yes -m all
6)      Login to database start the database(startup nomount).
7)      Run @contro.sql file.
SQL>select status from v$instance; it is in mounted state.
SQL>alter database open resetlogs; now it goes to open status.
SQL> select username from dba_users;
8)      Now copy ORADBUSR.SQL file from installation folder copy to sap backup directory and run.
SQL> @ORADBUSR.SQL
Enter value for         1: schema owner ID SAPSR3
                                2: file system NT
                                3: host name
                                4: SAP SID
Now again check the users
SQL>select username from dba_users;
Now you can see target system users only. Remove the source system users.
9)      Drop user
OPS$HOSTNAME\SIDADM  cascade.
10)   Now provide the permission to the target system users.
SQL> grant connect sapdba to “OPS$Hostname/SIDADM”;SAPSERVICESID;
SQL>grant dba to  “OPS$Hostname/SIDADM”;SAPSERVICESID;
11)   Now start the SAP system and is working or not.

DB!3 SAP Backup Create

DB13 Create and Check backup status
1
. On the command field, key in DB12 and below screen will be displayed. It shows the summary of the backup status.

2.
On command field, enter /nDB13. This T-code is used to perform backup. You can also check the backup status.






















3. In DB13, select a desired cell which you plan to perform your backup. Double click on the cell
4. Choose Full database backup to device
5. Backup mode: Offline
6. Device directory: ‘ d:\backup\ (this is just a folder which your backup could be stored)
7. Below is a sample picture.



SQL Installation Step by Step

SQL 2005 Installation:
Prerequisites:
  • Download the SQL 2005 Dump into the server.
  • Before kickoff the Installation, go through the SQL 2005 guide in sap market place. [server.sap.com]
Installation Steps: 
Step 1: Double click on setup.exefile. 
Step 2:Click to accept the terms & conditionsScreenHunter_4
ScreenHunter_5ScreenHunter_6 ScreenHunter_8
Step 3:Fill the registration information.ScreenHunter_9  
Step 4:According to SQL 2005 guide we need to select below option to 
implement SAP in it.ScreenHunter_10 
ScreenHunter_11  
Step 5:User Name must be SIDADM and provide strong password for  your SQL DB.ScreenHunter_131 
 And provide password for mixed mode authentication.  ScreenHunter_141 
Step 6:Just follow the SQL 2005 guide and set the below Collation settings
ScreenHunter_15 ScreenHunter_16 ScreenHunter_17 ScreenHunter_18 
Step 7:SAP recommendation, DB installation should be in J drive, and
  follow the guide and make the below changes.ScreenHunter_19 ScreenHunter_20 ScreenHunter_21 
Step 8: Finally we have successfully installed SQL 2005 in required server. PFBScreenHunter_26 ScreenHunter_27