Showing posts with label DB2. Show all posts
Showing posts with label DB2. Show all posts

Sunday, 5 September 2021

How to generate relocate.template file from IBM DB2

 

 
Generate relocate.template from IBM DB2
 
This section describes prerequisites and preparation steps that you have to perform for IBM Db2 for Linux, UNIX, and Windows before starting the system rename procedure.

Prerequisites:

  •     The database instance must be either stopped or - if it is running - there must not be any database connections.
  •     During the procedure it will be started and stopped automatically if required. After the preparation it will be stopped.
  •     Pleases ensure patch level of db6util is patch level 10 or higher. For more information.
  •     The patch level of the brdb6brt tool is patch level 32 or higher.
    If tool brdb6brt does not exist within the /sapmnt/<SAPSID>/exe directory, download and install it.

    IBM Db2 for Linux, UNIX, and Windows V10.1 and Higher only:

    Make sure that your <sapsid>adm user has execute permission for function sysproc.admin_get_storage_paths by running the following command on your source system as user db2<dbsid>:

    db2 "grant execute on specific function sysproc.admin_get_storage_paths to user <sapsid>adm"

    The version of SAP Host Agent must be 7.21 PL 26 or higher.

    If your operating system is Solaris SPARC or Solaris X86_64, the database version must be 9.7 FP7 or higher.

Procedure:

    Make sure that the SAP system is stopped. Use the below command to Create the relocate.template file. This file is required in the tool dialog phase.
 
        On the source system, log on as user db2<dbsid> and create the directory sapdbctrl-config under /tmp. This does not apply if the directory already exists.
        Note

        If directory /tmp does not exist, you must create it before you perform the steps listed below.

        Proceed as follows:

  •         Execute cd /tmp.
  •         Execute mkdir ./sapdbctrl-config
  •         Log off from the system.
  •         Log on again as user root on the source system.
  •         Execute cd /usr/sap/hostctrl/exe.
  •         Execute ./saphostctrl -function PrepareDatabaseCopy -dbname <DBSID> -dbtype db6 -dbconfdir /tmp/sapdbctrl-config/ -dbinstance db2<dbsid> -copymethod Offline -dostatechange.
        The system creates the relocate.template file in the /tmp/sapdbctrl-config directory.

        Check if the file relocate.template contains one or more entries for CONT_PATH or STORAGE_PATH. If not you must not start the system rename procedure.

        This is an example of the files created in the sapdbctrl-config directory:

        root@Techrelam01[Linux]/tmp/sapdbctrl-config > ls -la
        -rw-r----- 1 db2thr dbthradm 2584 Sep 05 19:23 db2thr.cfg
        -rw-r--r-- 1 root   root            46     Sep 05 19:23 db2thr.net
        -rw-r--r-- 1 root   root            8810 Sep 05 19:23 relocate.template

Provide all database-related directories on the target system. This includes the following directories:

    /db2/<DBSID>/

    The file system of the home directory of db2sid (default:/db2/db2<dbsid>).

To provide the required directories, use one of the following methods:
 
Note:
 
The commands below are given as an example if your home directory is db2<dbsid>. You have to adjust them for all required directories.

    If the source and the target system are located on one and the same host, proceed as follows:

    If you want to adjust or rename your SAP system on the same host, keep all directories at their locations.

    The tool will find and move them to the correct directory and set the required ownerships and permissions.

    Note

    If /db2/db2<dbsid> or /db2/<DBSID> is a mount point or there are mount points under these directories proceed as follows:

        Stop the SAP system including its instance agents.

        Unmount the mount points.

        Before you start the system rename, mount the file systems under the target <DBSID> or db2<dbsid>.

    If the source and the target system are located on different hosts, proceed in one of the following ways:

        Mount all file systems manually on the target system
        Recommendation

        This is the recommended option.
        Note

        If /db2/db2<dbsid> or /db2/<DBSID> is a mount point or there are mount points under these directories, then mount the file systems under the target <DBSID> or db2<dbsid>.

        Copy the directories using the copy command of the operating system.
        Note

        When you provide required database related directories on the target host, use the source <DBSID> within the directory names. The tool will find and move them to the correct location and set the required ownership and permissions.

        To keep the current ownership of the directory and softlinks, use an archiving tool as follows:

        source host:~ # tar -cpf /tmp/db2<dbsid_source>.tar /db2/db2<dbsid_source>

        source host:~ # tar -cpf /tmp/<DBSID_source>.tar /db2/<DBSID_source>

        source host:~ # scp /tmp/db2<dbsid_source>.tar <user>@<dbsid_source>:/tmp

        source host:~ # scp /tmp/<DBSID_source>.tar <user>@<target host>:/tmp

        target host:~ # tar -xvf /tmp/db2<dbsid_source>.tar /db2/db2<dbsid_source>

        target host:~ # tar -xvf /tmp/<DBSID_source>.tar /db2/<DBSID_source>

Make sure the contents of the db6_update_db.SAR archive attached to SAP Note 1365982 Information published on SAP site are available in the sapdbctrl-config directory.
Note

Make sure the permissions of file db6_update_db.sh and db6_update_db.jar are rwxr-xr-x. To check the file permissions, enter the following command:

ls -l db6_update_db.sh db6_update_db.jar.

To change the file permission enter the following command:

chmod 755 db6_update_db.sh db6_update_db.jar.

Make sure that you stop all system and database processes before you start the system rename procedure. To check that they are stopped, enter the following command: ps -ef | grep db2  
 
 
 
 
 
 Reference from : Help dot SAP

Thursday, 1 July 2021

How to update the password file using dscdb6up under Windows IBM DB2

 

How to update the password file using dscdb6up under Windows IBM DB2.

If you need to update the password file (dscdb6.conf), if you have changed password of <sid>adm user.

    Scenario 1

    You have changed the OS password of <sid>adm user beforehand.

    Scenario 2

    You have changed the OS password of <sid>adm user together with the password file update.

Solution for scenario 1

    dscdb6up -create <connect_user password> <current <sid>adm password>

    Solution for scenario 2

   dscdb6up <sid>adm <new password>

   Remarks:
   You may get the following error when executing the above command.
   **************************************************************************
   Current OS password does not match password in password file.
   Please enter current OS password for '<domain>\<sid>adm':
   **************************************************************************
   In such case, you need to enter the old (current) password first.

Note: dscdb6up file location SAP Kernel directory.


Thursday, 31 October 2019

Deployment Error during SAP JAVA STACK SUM Update with ERRORCODE=-4229


During the SAP JAVA Stack Upgrade Executaton Phase getting below error in Solution Manager 7.2 JAVA stack upgrade.

Operating System : SUSE LINUX 12 SP04
Database               : DB2 LUW 11.1 MP4 FP4

ERROR :

An SAP NW AS Java System upgrade terminates with the following error reported in DEPLOY-COMPONENTS.log 

Deployment of archive /install/SAP/nw75_java_ads_15/MMRSERVER15_0-80000683.SCA --> bi~mmr~mmrlib.sda for component sap.com/bi~mmr~mmrlib abortedDetailed message: 1. [jcc][t4][102][10040][4.25.15] Batch failure. The batch was submitted, but at least one exception occurred on an individual member of the batch.Use getNextException() to retrieve the exceptions for specific batched elements. ERRORCODE=-4229, SQLSTATE=null

Solution:

Workaround

Remove SECTION_LEVEL_LOB registry value from registry variable
DB2_RUNTIME_DEBUG_FLAGS.
Change:
 DB2_RUNTIME_DEBUG_FLAGS=TOLERANT_FLOAT,DISABLE_BLANK_TOLERANCE,
SECTION_LEVEL_LOB [DB2_WORKLOAD]

 To:
 DB2_RUNTIME_DEBUG_FLAGS=TOLERANT_FLOAT,DISABLE_BLANK_TOLERANCE [O]

Example:
> su - db2
 >db2set  DB2_RUNTIME_DEBUG_FLAGS

DB2_RUNTIME_DEBUG_FLAGS= TOLERANT_FLOAT, DISABLE_BLANK_TOLERANCE,
SECTION_LEVEL_LOB

db2set  DB2_RUNTIME_DEBUG_FLAGS = TOLERANT_FLOAT,DISABLE_BLANK_TOLERANCE
 
 




Thursday, 28 March 2019

How to Unlock & Reset SAP* Password in DB2


Unlock & Reset SAP* Password in DB2 


Log in to the operating system as db2 and switch to the SQL mode.
 

Status of the SAP* user
 

Execute as following.

db2 => select BNAME, MANDT, UFLAG from .USR02 where BNAME='SAP*'

BNAME  MANDT UFLAG
------------ -----        ------
SAP*         000        0
SAP*         500        0
SAP*         900        0


 3 record(s) selected.

 Unlock SAP* on DB2

Execute the following command.


UPDATE SAPSCHEMA.USR02 set UFLAG=0 where BNAME='SAP*' and MANDT='000'
 

Reset / Delete SAP* on DB2

Execute the following command.


DELETE SAPSCHEMA.USR02 where BNAME='SAP*'and MANDT='000'



Find SAP Schema name in DB2

Log in to the operating system as db2 and switch to the SQL mode. 


select schemaname from syscat.schemata

 







 

Monday, 18 March 2019

SAP cannot log onto the database DB6


Symptom

After a system copy, for example, the logon of SAP (Work processes, R3trans, tp) to the database does not work. For example, you notice the following error messages.
With DB2 Version 7: SQL1403N The username and/or password supplied is incorrect.

  •   With DB2 Version 8: SQL30082N Attempt to establish connection failed ...
  •  When you execute R3trans This is R3trans version 6.05 (release 46D - 16.05.02 - 15:45:00).2EETW169 no connect possible: "DBMS = DB6
    DFT = 'EI2'"

    R3trans finished (0012).
  •  The file trans.log contains the following error message: 4 ETW000 [developertrace,0] *** ERROR in DB6Connect[dbdb6.c, 1201] 4 ETW000 16557 4 ETW000 [developertrace,0] &+*** DB6Connect( SQLConnect ): er] SQL10002N The password supplied is too long. SQLSTATE=28000 4 ETW000 74 4 ETW000 [developertrace,0] &+*** 60 4 ETW000 [developertrace,0] &+*** 61 4 ETW000 [developertrace,0] *** ERROR in DB6Connect[dbdb6.c, 1201] 4 ETW000 51

 Other Terms
  db6, db2udb, SQL1403, dbcdb6up, dscdb6.conf, DB2DB6EKEY, SQL30082
 
Reason and Prerequisites


The passwords of the adm and sap or sapr3 users are stored in enciphered form in the file system. The value of the environment variable DB2DB6EKEY is used for the code. This variable can be maintained inconsistently on UNIX systems for different users and shells. The error occurs in particular when shell scripts are called that are often written for the corn shell while the users are running under the C shell.


Solution
 
Check the setting of this variable for both the corn shell (ksh) and C shell (csh) of the users db2 and adm.


After the value is set in a uniform manner, you need to log on again on the
operating system level. It may be necessary to reset the passwords so that they
can be deciphered again by the SAP programs. Proceed as follows. 

adm>
dscdb6up adm
dscdb6up sap

 
Note:
Environment variables are usually set in the user profiles which are imported
during the login or when the shell is called. The profiles are usually stored in
the .-files in the $HOME of the users. The profile files of the corn shell end
with .sh, and those of the C shell with .csh. Check this with
grep DB2DB6EKEY .??* 






More details refer Snote :582875

Sunday, 8 October 2017

How to Turn off Archive log in DB2 datbase


The Following steps to Turn off archive log in DB2 DATABASE

 First Log on to Database server with db2 user.

Before that Check the status of Archive log Status.

        db2 archive log for db

Execute below commands to turn off archive log.

       db2  update db cfg for using logretain off
       db2 update db cfg for

 Restart SAP application Server & Database to effect the changes.

  Check archive log OFF or ON with below command

   db2 archive log for db   
   
If output “Archive log not allowed “then archive log was OFF.
else
Still Archive log in ON.

Sunday, 7 May 2017

DB2 Backup Command

DB2 Backup Command and Procedure.


Step 1: db2stop

Step 2: db2start

Step 3: db2 connect to <DB2SID>

Online backup command

db2 backup <DB2SID> online to "backup stored directory"

Offline backup command

db2 backup db <DB2SID>  to "backup stored directory"

Online backup command with compress

db2 backup <DB2SID> online to "backup stored directory" compress

Offline backup command

db2 backup db <DB2SID>  to "backup stored directory" compress

Get backup details (%) on while backup running.

db2 list utilities show detail