Wednesday 21 October 2015

EXPORT WITH COMPRESS SCRIPT




                   EXPORT WITH COMPRESS SCRIPT

               
# BEFORE RUNNING THIS SCRIPT, USE the mknod command to create a named pipe
# called /dev/PIPE.dmp (mknod is Unix command, PIPE.dmp is an arbitrary name).
# Then set environment variables for ORACLE_HOME, ORACLE_SID, and DUMPDIR, as
# well as PATH if needed.
# If you save the script as, say, exp_comp.sh, type
#             % exp_comp.sh & 
# at the Unix prompt to run it.
# WARNING: You must have unique names for each pipe if you have
# multiple concurrent executions of this script.

trap '' 1 # nohup

# Set these to appropriate values
ORACLE_HOME=
ORACLE_SID=
DUMPDIR=

# Customize PATH if needed
PATH=/bin:/usr/bin:${ORACLE_HOME}/bin:/usr/local/bin:/usr/lbin

export ORACLE_HOME ORACLE_SID PATH
LOGFILE=$DUMPDIR/exp${ORACLE_SID}.log
exec >$LOGFILE 2>&1

echo "Exporting $ORACLE_SID database. start `date`"

# Customize this as needed
exp system/manager GRANTS=Y FULL=Y INDEXES=Y COMPRESS=Y FILE=/dev/PIPE.dmp &

compress </dev/PIPE.dmp > $DUMPDIR/exp$ORACLE_SID.dmp.Z &

Create a shell script to run export/import utilities.



You want to create a shell script to run export/import utilities. 


# SCRIPT 
# ---------
# 
# Set environment variables for ORACLE_HOME, ORACLE_SID, 
# and DUMPDIR -- in case of datapump --, as well as PATH if needed.
#
#

trap '' 1 # to use nohup in a shell script 

# Set these to appropriate values if needed:
#
#ORACLE_HOME=
#ORACLE_SID= 
#DUMPDIR= 

# Customize PATH if needed 
#
#PATH=/bin:/usr/bin:${ORACLE_HOME}/bin:/usr/local/bin:/usr/lbin 

#export ORACLE_HOME ORACLE_SID PATH 

echo "Exporting $ORACLE_SID database. start `date`" 
# 
expdp system/password dumpfile=scott.dmp directory=DUMPDIR schemas=scott logfile=scott.log
#
echo "Export of $ORACLE_SID database completed at `date`" 

#End of Script

Tuesday 6 October 2015

Before killing an active session---precheck

Before killing an active session---precheck.





SELECT O.OBJECT_NAME, S.SID, S.SERIAL#, P.SPID, S.PROGRAM,SQ.SQL_FULLTEXT, S.LOGON_TIME FROM V$LOCKED_OBJECT L, DBA_OBJECTS O, V$SESSION S, V$PROCESS P, V$SQL SQ WHERE L.OBJECT_ID = O.OBJECT_ID AND L.SESSION_ID = S.SID AND S.PADDR = P.ADDR AND S.SQL_ADDRESS = SQ.ADDRESS;
select   c.owner,  c.object_name,  c.object_type,  b.sid,  b.serial,
   b.status, b.osuser, b.machine
from
   v$locked_object a , v$session b, dba_objects c
where
   b.sid = a.session_id
and a.object_id = c.object_id;

SELECT 'ALTER SYSTEM KILL SESSION ' ||''''||SID||','||SERIAL#||'''' ||' ;' FROM v$session WHERE USERNAME NOT IN ('SYS') and username is not null and status='ACTIVE';

             


SELECT * FROM V$SESSION WHERE STATUS = 'ACTIVE';

select username, sid, serial from v$session where username='XXXXXX';

select addr,pid,spid,username,pga_used_mem from v$process where addr = 'XXXX';
 




The purge process did not run because the Oprid configured to start the Process Scheduler did not have the required permissions to run the purge process.

  Purge process - Required permissions The PeopleSoft Oprid used to start the Process Scheduler, as defined in the Scheduler's psprcs.cf...