Retrieve old versions of procedures with Flashback Query


Retrieve old versions of procedures with Flashback Query


SQL> select text from dba_source as of timestamp systimestamp - interval '30' minute where name='XXXX' order by line;

Configuring Unix / Linux File and Directory Access Rights

Configuring Unix / Linux File and Directory Access Rights
 

Below are some other examples of how to use the chmod command:

>> full access for everybody:
chmod 777 filename
>> full access for owner and group privileges but other users can only read and execute:
chmod 775 filename
>> full access for owner, but restricting group and other user privileges to only read and execute for files in the directory:
chmod 755 dirname
>> full access for the owner with no access rights or privileges for anyone else:
chmod 700 filename
chmod 700 -r /path/to/folder
>> no access to files in directory for group or other users and owner restricted to read and execute privileges to prevent the accidental deletion or modification of

files in the directory:
chmod 500 dirname
>> allowing the owner and group read and write access to a file, allowing others in the group to edit or delete the file as well as the owner, but with no access for

other users:
chmod 660 filename

===============================

APPS_TS_TX_DATA and APPS_TS_TX_IDX size keep on increasing


APPS_TS_TX_DATA and APPS_TS_TX_IDX size keep on increasing

Step1: Truncate these tables:-


SQL>truncate table xla.XLA_DIAG_SOURCES;

SQL>truncate table xla.XLA_DIAG_EVENTS;

Step2: Turn OFF the “SLA: Diagnostics Enabled” profile option at all levels.

Step3: Check the tables, tablespace and archive logs status

===============================

How to set the path and environment variables in Windows


How to set the path and environment variables in Windows

Windows 8 users
From the Desktop, right-click the very bottom left corner of the screen to get thePower User Task Menu.
From the Power User Task Menu, click System.
Click the Advanced System Settings link in the left column.
In the System Properties window, click on the Advanced tab, then click theEnvironment Variables button near the bottom of that tab.
In the Environment Variables window (pictured below), highlight the Path variable in the "System variables" section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon as shown below.

C:\Program Files;C:\Winnt;C:\Winnt\System32



Note: You can edit other environment variables by highlighting the variable in the "System variables" section and clicking Edit. If you need to create a new environment variable, click New and enter the Variable name and Variable value.

To view and set the path in the Windows command line, use the path command.
Windows Vista and Windows 7 users
From the Desktop, right-click the Computer icon and select Properties. If you don't have a Computer icon on your desktop, click the Start button, right-click theComputer option in the Start menu, and select Properties.
Click the Advanced System Settings link in the left column.
In the System Properties window, click on the Advanced tab, then click theEnvironment Variables button near the bottom of that tab.
In the Environment Variables window (pictured below), highlight the Path variable in the "System variables" section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon as shown below.

C:\Program Files;C:\Winnt;C:\Winnt\System32



Note: You can edit other environment variables by highlighting the variable in the "System variables" section and clicking Edit. If you need to create a new environment variable, click New and enter the Variable name and Variable value.

To view and set the path in the Windows command line, use the path command.
Windows 2000 and Windows XP users

The path is now managed by Windows 2000 and Windows XP and not the autoexec.bat or autoexec.nt files as was done with earlier versions of Windows. To change the system environment variables, follow the steps below.
From the Desktop, right-click My Computer and click Properties. If you don't have a My Computer icon on your desktop, click the Start button, right-click the My Computer option in the Start menu, and select Properties.
In the System Properties window, click on the Advanced tab.
In the "Advanced" section, click the Environment Variables button.
Finally, in the Environment Variables window (as shown below), highlight the Pathvariable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon as shown below.

C:\Program Files;C:\Winnt;C:\Winnt\System32



Note: You can edit other environment variables by highlighting the variable in the "System variables" section and clicking Edit. If you need to create a new environment variable, click New and enter the Variable name and Variable value.

To view and set the path in the Windows command line, use the path command.
What is the default Windows Environment Path?

The path is based on programs installed on the computer, so there is no "default path". However, the Windows minimum path is typically the path below.

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem

Note: Keep in mind that as you install programs, the path is updated with the paths for the newly installed programs. So, if you have erased your path after installing other programs, those programs may be affected.

Script for trimming alert log to 1 day and taking backup of previous day

Script for trimming alert log to 1 day and taking backup of prev day

#!/usr/bin/ksh

############################################################################
##  Program :   save_alert_log.sh                                          #
##                                                                         #
##  Purpose :   The alert logs on many Oracle databases can grow to a very #
##              large size over time.  This can often impede the maintenace#
##              of the system – because the DBA will need to sometimes scan#
##              through many days or months of data when researching an    #
##              issue.  This script tries to avoid that by ensuring that   #
##              the log file can be “refreshed” on a daily basis, meaning  #
##              that only the current day’s data will be kept in the log,  #
##              while the previous day’s data will be saved to another file#
##              in a backup area.                                          #
##                                                                         #
##              This script should be run from Oracle’s crontab at midnight#
##              every night, so that the database will always have a new   #
##              alert log file each day.  An example crontab entry could be#
##              0 00 * * * /oracle/product/local/scripts/save_alert.sh 2>&1#
##                                                                         #
##  Date    :   19 May 2006.                                               #
##  Author  :   Basil S. Mullings                                          #
############################################################################
##  Modified:                                                              #
##                                                                         #
##                                                                         #
#  Modification History:                                                   #
#  DATE       WHO      DESC                                                #
#  ——–   —–    —————————————————-#
#  05/29/06   Basil    Add an extra variable LOG_KEEP_DAYS to hold the     #
#                      number of days that the log files should be kept on #
##                     the server before being deleted.                    #
##                                                                         #
##                                                                         #
############################################################################

##Setup some needed variables.
BKUP=bkup   ##The backup directory to store the logs…
ORATAB=”/etc/oratab”
LOG_KEEP_DAYS=365   ##Keep this many days of log files on the server.
TMPFILE=/var/tmp/OracleAlertLog   ##Just a temp scratch work area.
SQLUSER=”/ as sysdba”
GEN_ORA_ERROR=”ORA\-[0-9][0-9]*”
PATH=”$HOME:$HOME/bin:/usr/contrib/bin:/usr/local/bin:/usr/bin:/bin:/etc:.”
export PATH

## Now, parse the oratab file for all databases on the system.
## Then use the ORACLE_SID that is found in the oratab file
## to log onto that database, and retrieve the directory where
## the alter log file is stored (.ie. retrieve the path to the
## bdump directory.
##
#for sidEntry in `cat $ORATAB | grep -v “^#”`
for sidEntry in `cat $ORATAB | awk -F: ‘{print $1}’ | grep -v “^#”`
do
## Get date and time
CURR_DATE=`date ‘+%a_%m%d%H%M’`    ##Example Fri_05191256   for Friday May 19th @1256 PM.

#ORACLE_SID=`echo  $sidEntry | cut -f 1 -d :`
ORACLE_SID=$sidEntry
echo “Oracle Sid is $ORACLE_SID”

export ORACLE_SID
## Set the Oracle environment for this SID.
ORAENV_ASK=NO
. /usr/local/bin/oraenv
rm -f $TMPFILE > /dev/null 2>&1

##Now, let’s log onto the DB, and try to
##retrieve the bdump directory path.
sqlplus -s /nolog << EOF > $TMPFILE
connect $SQLUSER
set heading off;
set echo off;
set feedback off;

select ‘BACKGROUND_DUMP_DEST=’ ||value
from   v\$parameter
where  name=’background_dump_dest’;
exit;
EOF

##Ok, we had a problem talking to the database.
if [ `grep -c $GEN_ORA_ERROR $TMPFILE` -ne 0 ]
then
echo “ERROR: Unable to find the path to the alert log for DB $ORACLE_SID”
rm -f $TMPFILE > /dev/null 2>&1

else  ##Ok, we can log into the DB, now let’s go find our bdump directory.

bdump=`grep BACKGROUND_DUMP_DEST $TMPFILE | awk -F “=” ‘{print $2}’`
#echo “BDUMP is $bdump”
bkupDir=$bdump/$BKUP

##Make sure our backup directory exists.
if [ ! -d $bkupDir ]
then
mkdir $bkupDir  > /dev/null 2>&1
fi

##Now, move the alert log.
#echo “now moving $bdump/alert_${ORACLE_SID}.log to $bkupDir/alert_${ORACLE_SID}.$CURR_DATE”
mv $bdump/alert_${ORACLE_SID}.log  $bkupDir/alert_${ORACLE_SID}.$CURR_DATE

#Procedure to shrink the log to 365 days
##Keep only the last 365 days worth of logs…delete all logs older than 365 days.
#echo “Now shrinking the logs in dir $bkupDir …”
find $bkupDir  -name “*.*” -mtime +${LOG_KEEP_DAYS} -exec rm -f {} \;
fi

done