Posts

Showing posts from April, 2013

DBMS_METADATA.GET_DDL

###Pulling out the Source code/extracting the code We have DBMS_METADATA.GET_DDL  Handy to complete the task. set pagesize 0 set long 90000 SELECT DBMS_METADATA.GET_DDL('PACKAGE',' ') FROM dual; To extract package body  definition from database: set pagesize 0 set long 90000 SELECT DBMS_METADATA.GET_DDL('PACKAGE_BODY',' ' ) FROM dual; To extract user definition: set pagesize 0 set long 100000 select dbms_metadata.get_ddl( 'USER', ' ' ) from dual UNION ALL select dbms_metadata.get_granted_ddl( 'SYSTEM_GRANT', ' ' ) from dual UNION ALL select dbms_metadata.get_granted_ddl( 'OBJECT_GRANT', ' ' ) from dual UNION ALL select dbms_metadata.get_granted_ddl( 'ROLE_GRANT', ' ' ) from dual; To extract tablespace definition: SELECT dbms_metadata.get_ddl('TABLESPACE','&&tbs_name') FROM dual; To extract table definition: SELECT dbms_metadata.get_ddl('TABLE',upper(

Suspend and Resume your query execution without killing the session using oradebug utility

You can suspend and resume of your query execution without killing the session using oradebug utility. SELECT pid FROM v$process WHERE addr IN ( SELECT paddr FROM v$session WHERE sid = &sid ); ORADEBUG SETORAPID ORADEBUG SUSPEND ORADEBUG RESUME

Trace file maintainance in 9i and 10g

Hello, Trace file maintenance is a part of DBA activity, to accomplish this script is given below. I have created a script to delete the trace file automatically, you can schedule this in your crontab and trace file maintenance will be taken care. Note:- You may customize this according to your need. Here is the Script code. -------------------------------- #!/bin/ksh . /home/oracle/.profile DATETIME=`date +%Y%m%d` DBA_MAIL_GRP="ghufranahmedkhan@gmail.com" #track script start time echo "" > /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log 2>&1 echo "$0: Script Start Time: `date`" >> /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log 2>&1 echo "" >> /u01/app/oracle/admin/scripts_shop/trace_file_deletion_$DATETIME.log 2>&1 #Deleting Trace Files on Production server older than 30 days echo "\nDeleting Trace Files on Production server older than 30 days.."

RMAN-06214: Datafile Copy .....

Having difficulty deleting control file. Use the below command to delete it. Error:-RMAN-06214: Datafile Copy   /bkp/oracle/ora_ctl.ctl Solution --------------- RMAN> crosscheck copy; RMAN> delete expired copy;