Você está na página 1de 14

Handy Oracle SQL commands

1.Count no. of records in a table select count(*) from sapsr3.vbfs; 2. Count no. of sessions in db SELECT inst_id, count(*) "DB Sessions" FROM gv$session WHERE type = 'USER' GROUP BY inst_id; 3.Check status of file in recovery select FILE#,STATUS from v$datafile where status like '%REC%'; 4. Check status of file in Offilne state select FILE#,STATUS from v$datafile where STATUS like 'OFFLINE'; 5. Rebuild index online alter index "SAPSR3"."RSSTATMANREQMAP~PT" rebuild online; 6.Check last optimizer statiscs run select TABLE_NAME, STATUS, LAST_ANALYZED from DBA_TABLES where TABLE_NAME='VBFS'; 7. Determine file name from file id. select FILE_NAME from dba_data_files where FILE_ID in (56,59,60,61,62,63,65,66,67,68);

RMAN for SAP BRTOOLS


Important point needs to be consider while configuring RMAN for SAP BRTOOLS. I had to configure RMAN for taking incremental backup of our SAP database by using RMAN. Here i have mentioned point which helped me to connect BRTOOLS to RMAN.

create following link first after installing TSM service at OS host cd $ORACLE_HOME/rdbms/lib ln -s /usr/tivoli/tsm/tdp_r3/ora64/libtdp_r3. /usr/lib/libobk. ln -s /usr/lib/libobk.so $ORACLE_HOME/lib/libobk.so

Mentione device type as for taking backup through RMAN backup_dev_type=rman_util

Set rman_parms to identify brtools for TSM parameters. rman_parms="ENV=(XINT_PROFILE=/init.utl,PROLE_PORT=,&BR_INFO)" Locate the appropriate ProLE port number in the /etc/services file. Look for port name tdpr3ora64 Below parameters also need to set in initsid.sap parameter file saveset_members = 1 rman_channels = 6 : This parameter defines the number of parallel channels used by RMAN with an external backup library, that is, backup_dev_type = rman_util rman_filesperset = 8 Make sure /usr/lib is specified in the library path environment of your system.

Shared memory issue while starting sapccmsr


SAPCCMSR not getting started First try to clear shared memory by executing following command. sapccmsr -initshm pf=/sapmnt//profile/ Even if doesnt clear the shared memory from system for sapccmsr. Then check shared memory segment 4dc4 from user id sapadm. To identify shared memory segment execute following command ipcs -am | grep sapadm If it is there then need to clear it Note : Only clear shared memory segment 4dc4. This is related to monitoring segment, until it doesnt get clear sapccmsr will not start. Once it is cleared sapccmsr will start on that host.

GRMG configuration for TREX system

Friday, June 24, 20111comments


1.Log on to the TREX host as root 2. Go to the directory . : /usr/sap/TPZ/TRX10 Set the environment variables required by TREX by executing the following scripts. . TREXSettings.sh

3. Go to the directory /exe/CCMS, in which the script for installing the TREX monitoring functions is located

4.Execute the following command to configure monitoring of availability (heartbeat/GRMG): python ccms_config.py --grmg

Created GRMG upload file at location : /usr/sap/TPZ/TRX10/hostname/trace/grmg/GRMG_config.TPZ_10.hostname.xml

Uploading XML Customizing File by Transaction GRMG


1. Start transaction GRMGin the SAP system. 2. Choose Upload/Download. There are two ways to upload the TREX scenario: Choose Upload/Download Upload Scenario.

Choose the XML customizing file for the corresponding TREX instance and choose Open.

The window GRMG customizing file uploaded successfully appears.

Choose Upload/Download Poll agents for new scenarios.

This upload of the TREX scenario will only work if the SAPCCMSR agent is running and has been registered previously. In the list GRMG Scenarios for Availability Monitoring, choose the corresponding TREX scenario. Choose Start/Stop Start Scenarios. The window GRMG scenarios have started appears.

Oracle Bundle Patch


How to Apply Oracle Bundle Patch

Download the dump from SAP service market place to your system. 1.PRE INSTALLATION INSTRUCTIONS Copy the dumps of patch at below mentioned path. Drive/oracle/"SID"/"oracle version"/OPatch

Stop SAP & DB along with all services of SAP & DB. Back up the current database that is installed, the %ORACLE_HOME% directory and Oracle inventory under c:\Program files\oracle directory. (This will help if there are problems applying the patch, and to restore the Inventory in case of an issue with the patch.) Now apply bundle patch. OPatch>opatch apply patch no Installation may be interrupted coz. of error in overwriting an existing .dll file giving following error file already in use. In case of above error dont rename the file and RETRY(It doesnt work) instead cancel the installation then and there rename the .dll file and start patch application again. 3. POST INSTALLATION INSTRUCTIONS Start all services of DB & DB Run script catcpu.sql sqlplus /nolog SQL> CONNECT / AS SYSDBA SQL> STARTUP

SQL> @%ORACLE_HOME%\Bundle\Patch17\catcpu.sql SQL> QUIT If above script reports any error then Inspect the logfile %ORACLE_HOME%\Bundle\Patch17\Apply__.log for any errors. If catcpu.sql reports any Invalid Objects, compile the invalid objects as follows. sqlplus /nolog SQL> CONNECT / AS SYSDBA SQL> @%ORACLE_HOME%\rdbms\admin\utlprp.sql 0 Above script will compile the invalid objects. To check for any invalid objects still there or not, execute the following statement: SQL> SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID'; Recompiling Views in the Database To recompile the views for each database instance running out of the ORACLE_HOME being patched , follow these steps: Run the pre-check script, which reports the maximum number of views and objects that may be recompiled: sqlplus /nolog SQL> CONNECT / AS SYSDBA SQL> @%ORACLE_HOME%\Bundle\view_recompile\ recompile_precheck_jan2009cpu.sql SQL> QUIT Run the view recompilation script. Note that this script is run with the database in upgrade mode, which restricts connections as SYSDBA. sqlplus /nolog SQL> SHUTDOWN

SQL> CONNECT / AS SYSDBA SQL> STARTUP UPGRADE SQL>@%ORACLE_HOME%\Bundle\view_recompile\ view_recompile_jan2008cpu.sql SQL> SHUTDOWN; SQL> STARTUP; Check the log file for any errors. The log file is in the current directory and is named: vcomp__.log If any invalid objects were reported, run the utlrp.sql script as follows: sqlplus /nolog SQL> CONNECT / AS SYSDBA SQL> @%ORACLE_HOME%\rdbms\admin\utlrp.sql If still any invalid objects are there then recompile those manually. SQL> alter schemaname. compile; Verify that the view recompilation has been performed for the database, by executing the following statement: SELECT * FROM registry$history where ID = '6452863'; TO VIEW ALL PATCHES APPLIED ISSUE BELOW COMMAND:\ORACLE\"SID"\"oracle version"\OPATCH>OPATCH LSINVENTORY

SAP Test system refresh activity


SAP Test system refresh activity. Follow the below steps for SAP test system refresh activity from Production server backup.

1. Take the relevant screenshot of system STMS,SCC4,SM59,SAP standard jobs,DB13,SLICENSE,CCMS settings,SPAD 2. Import the SPAD settings 3. Take the offline backup of production system 4. Take the backup of backSID.log,*.aft and initSID.ora of production and test server 5. Lock users in Test system 6. Take offline backup of test system 7. Open client in test server : SCC4 8. Export the client for profile SAP_USER in test server. Keep test system as target server SCC8

9. Take the trace of control file on both the Test and production server 10. Stop the SAP instance and sap services 11. Note down the Schema users existing presently in the system. SQL> select user name from dba_users;

12. Shutdown the database 13. Copy last offline backup log file(*.aft) from production system to test server 14. edit the *.aft log file as per test server change SID from prdoduction to test server SID, check ORA-HOME directory 15. Now restore the backup brrestore c m full b XXX.aft 16. Connect to oracle as sqlplus /nolog, connect /as sysdba and type startup Nomount. 17. Edit the controlfile of Prod. Change all production SID to test SID and NORESETLOGS TO RESETLOGS. 17. Use the edited controlfile of Prod to recreate the control file of Test SQL> @Cntrl.sql SQL>shutdown immediate; 18. SQL> Alter database open RESETLOGS. 19. Create new OPS$ADM using the below command. I:\scripts>sqlplus /nolog @ORADBUSER.sql SAPSID NT DOMAIN SID (IF SIDADM is local user then give the host name in the place of Domain Name) 20. After this run the script sapdba_role to set proper right for OPS$ user IDs. >sqlplus /nolog @sapdba_role.sql

21. Check whether SAPSR3P (schema owner) account has been locked or not: select username,account_status from dba_users where username=SAPPCE; 22. If it is locked use this command to unlock it: alter user SAPPCE account unlock; 23. Start the SAP application.

POST Processing Steps: 24. Update the license Logon to SAP with DDIC-client 000; update the license key through the transaction SLICENSE. 25. check the consistency Go to transaction SICK for checking the consistency of the system. 26. check the local host entry Go to transaction SE37 and execute BPT_LOCAL_HOSTNAME_CHECK to check for the hostname entry. 27. Change the STMS configuration and perform post installation activity Now go to transaction SE06 to perform post installation activities 28. Reconfiguring STMS 29. Login into DCE client 000 with DDIC , goto transaction STMS. 30. Schedule the standard jobs Go to transaction SM36 and click on the button Standard jobs to schedule the standard jobs defined for the system. 31. Import the user master of test server Goto the STMS and import the user master request 32. Close the client 33. Changing the client description. 34. Import profiles of active Server using RZ10. 35. Delete incorrect instances defined in RZ04, create correct instances and assign Operation modes for the same 36. Change the logical system name 37. Take an OFFLINE backup of the Test system and release the system to the users.

The entire procedure for DRS switchover

Sunday, June 21, 20091comments

PRODUCTION TO DRS SWITCHOVER 1. Take Offline backup of the PRD Database. 2. In SM02, Put message on the PRD system. 3. On PRD, cmd>SVRMGR30 Connect Internal; Alter system switch logfile; Do switch log file 3-4 times. 4. In DRS, apply up to the last Archive Log created in PRD. 5. On PRD, Stop R/3, Shutdown Database And Stop SAP & Oracle Services. 6. On PRD, Backup Mirrlog A, Mirrlog B, Origlog A, Origlog B & Control file of PRD. 7. Shutdown DRS Database & Stop Oracle Services. 8. On DRS, Backup Mirrlog A, Mirrlog B, Origlog A, Origlog B & Control file of DRS. 9. Copy the redo log files & control files from PRD (production DB System) to DRS (DRS DB System). Copy the control file to all the locations on DRS (OriglogA, Saparch & Sapdata1 subfolders). 10. Start the Oracle Services on DRS. 11. In DRS Start SVRMGR30 Connect Internal; Startup Mount; Recover Database; (Ensure the message Media Recovery Complete appears). Alter databases Open; (This opens in NORESETLOGS mode). Exit; 12. Start SAPOSCOL, SAP_00 services on DRS. 13. Start SAP R/3 application on DRS. 14. Logon to the DRS System through SAP Logon Pad. 15. Check the System Status & transactions like SM51, ST22, and SM21 Etc.

DRS TO PRODUCTION SWITCHOVER

16. On DRS, Stop R/3, Shutdown Database and Stop SAP & Oracle Services. 17. Copy the redo log files & control files from DRS (DRS DB System) to PRD (production DB System). Copy the control file to all the locations on PRD (OriglogA, Saparch & Sapdata1 subfolders). 18. Start the Oracle services on the DRS. 19. Start the Oracle Services on PRD. 20. In PRD Start SVRMGR30 Connect Internal; Startup Mount; Recover Database; (Ensure the message Media Recovery Complete appears). Alter databases Open; (This opens in NORESETLOGS mode). Exit; 21. Start SAPOSCOL, SAP_00 services on PRD. 22. Start SAP R/3 application on PRD. 23. Logon to the PRD System through SAP Logon Pad. 24. Check the System Status & transactions like SM51, ST22, and SM21 Etc. Note: - DRS: DRS database server PRD: Production database server

Explain the client create, delete and copy?

Friday, April 10, 20093comments


We can create a client using the transaction SCC4. Mention the client name with the appropriate selection. Note that SAP delivers the software with standard clients 000 and 001. You may not work in client 000, but may use client 001. However, SAP recommends that you begin SAP System implementation by creating a new client as a copy of client 000.

To Copy a client o A local client copy copies between clients within the same SAP System. o A remote client copy allows you to copy between clients in different SAP Systems.You can use a remote client copy to, for example, transport client-dependent as well client-independent Customizing data between SAP Systems.

o o o

A remote client copy proceeds in the same way as a local copy, but sends the data through a remote function call (RFC) connection to the target client. A remote client copy is easy to use, and does not require file system space on operating system level. The limitations of a remote client copy are as follows: A remote client copy does not create a file at operating system level, so there is no "hard copy" of the client to be copied. Therefore, the same, identical client copy cannot be duplicated at a later date.

To delete a client from within SAP System: o Log on to the client to be deleted. o Use the menu option use Transaction code SCC5 or from the SAP System initial screen choose Tools _ Administration _ Administration _ Client admin _ Special functions _ Delete client. o Start the deletion of the client, preferably using background processing. o When you delete a client entry from table T000 with client maintenance (Transaction SCC4), you can no longer log on to the client or update it using change requests. The deletion process, however, does not eliminate the data belong to the client. This means the client-dependent data remains in your SAP System, occupying space in the database. Therefore, to eliminate an SAP client entirely, that is, to delete both the client and the client-dependent data, use the client delete functionality (Transaction SCC5). o Deleting a client entry with client maintenance (Transaction SCC4) allows you to temporarily lock the client. The deletion procedure preserves the data for the client but prevents users from logging on to the client or accessing the data belonging to the client. To restore the client and allow logon, recreate the client entry using client maintenance. o The amount of time required for the deletion of a client can be reduced by performing the deletion using parallel processes.

Você também pode gostar