Script for unzipping all the files in a specified directory.
#################################################################################
CURRENDIR=/home/oracle/zip
cd $CURRENDIR
rm $CURRENDIR/zipfiles 2>/dev/null
ls -1 *.zip
if [ $? -eq 0 ]
then
echo ".zip file found"
ls -1 $CURRENDIR/*.zip > $CURRENDIR/zipfiles
for i in `cat $CURRENDIR/zipfiles`
do
unzip $i
done
fi
if [ $? -eq 1 ]
then
echo "NOT found"
fi
###############################################################################
system-config-firewall-tui
system-config-network-tui
system-config-
How to install the desktop environment in unix environment ?
yum install gnome*
#############################################################################
#Folders to create:
#1. $BACKUP_BASE=/flasharea/rman_backup/remitdb (Just an example)
#2. $BACKUP_BASE/ARCH_BACKUP
#3. $BACKUP_BASE/LOGS
#4. $BACKUP_BASE/$FOLDER_NAME/RMAN_LOGS
#5. $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET
#6. $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP
#7. $BACKUP_BASE/$FOLDER_NAME/CF_BACKUPSET
#8. $BACKUP_BASE/$FOLDER_NAME/CF_AUTOBACKUP
#9. $BACKUP_BASE/$FOLDER_NAME/COPY_DB
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=remitdb
export PATH=$PATH:$ORACLE_HOME/bin
export BACKUP_BASE=/flasharea/rman_backup/remitdb
export DATE_WITH_TIME=`date +%Y%m%d-%H%M%S`
export DATE_TIME=`date +%Y%m%d`
#export DATE_TIME=`date +%Y%m%d-%H%M%S`
export FOLDER_NAME="DB"_$DATE_TIME
############################# CREATING NECESSARY FOLDERS FOR BACKUP ####################################
#echo Starting Backup ...................................................................................
#echo `date +%m%d%Y-%H%M%S` >> $BACKUP_BASE/RMAN_LOGS/DB_""$DATE_TIME.log
echo Creating backup destination folders ................................................................
echo Creating backup destination folders $BACKUP_BASE/RMAN_LOGS for RMAN Log files history...............
mkdir -p $BACKUP_BASE/RMAN_LOGS
#echo Creating backup destination folders $BACKUP_BASE/LOGS for RMAN log files.................
#mkdir -p $BACKUP_BASE/LOGS
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/LOGS for RMAN log files.................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/LOGS
echo Creating Log file $BACKUP_BASE/$FOLDER_NAME/LOGS/DB_""$DATE_WITH_TIME.log for current operation
export LOG_FILE_NAME=$BACKUP_BASE/$FOLDER_NAME/LOGS/DB_""$DATE_WITH_TIME.log
touch $LOG_FILE_NAME
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP for archive log files..................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET for DB Backupsets..........
mkdir -p $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP for spfile....................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/CF_BACKUP for controlfile...............
mkdir -p $BACKUP_BASE/$FOLDER_NAME/CF_BACKUP
#echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/COPY_DB for RMAN copy of database.......
#mkdir -p $BACKUP_BASE/$FOLDER_NAME/COPY_DB
############################# FINISHED CREATING NECESSARY FOLDERS FOR BACKUP ##############################
$ORACLE_HOME/bin/rman target / nocatalog log = $LOG_FILE_NAME append << EOF
run
{
ALLOCATE CHANNEL c1 DEVICE TYPE DISK MAXPIECESIZE 2G;
#ALLOCATE CHANNEL c2 DEVICE TYPE DISK MAXPIECESIZE 2G;
#ALLOCATE CHANNEL c3 DEVICE TYPE DISK MAXPIECESIZE 2G;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/CF_AUTO_%F';
#Retention policy to be defined by client
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
SQL "ALTER SYSTEM SWITCH LOGFILE";
#####BACKUP AS BACKUPSET DATABASE FORMAT '$BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET/DB_%U';
BACKUP DATABASE FORMAT '$BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET/DB_%U';
#####BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT '$BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET/DB_%U';
BACKUP ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES SKIP INACCESSIBLE;
#####BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES SKIP INACCESSIBLE;
#Enable the DELETE command below on confirmation with client.
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 2 TIMES TO DISK;
BACKUP SPFILE FORMAT '$BACKUP_BASE/$FOLDER_NAME/SP_BACKUP/SP_%U';
BACKUP CURRENT CONTROLFILE FORMAT '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/CF_BS_%d_%u_%s_%T';
COPY CURRENT CONTROLFILE to '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/control01.ctl';
#CROSSCHECK BACKUP;
release channel c1;
#release channel c2;
#release channel c3;
}
exit;
EOF
cp $LOG_FILE_NAME $BACKUP_BASE/RMAN_LOGS
cp $ORACLE_HOME/dbs/initremitdb.ora $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP/initremitdb.ora
echo Backup RMAN log files: cp $LOG_FILE_NAME $BACKUP_BASE/RMAN_LOGS >> $LOG_FILE_NAME
echo 'End RMAN Backup of pigeon Database:' >> $LOG_FILE_NAME
date >> $LOG_FILE_NAME
exit
#########################################################################
RMAN SCRIPT for archive backup.
#Folders to create:
#1. $BACKUP_BASE=/flasharea/rman_backup/remitdb (Just an example)
#2. $BACKUP_BASE/ARCH_BACKUP
#3. $BACKUP_BASE/LOGS
#4. $BACKUP_BASE/$FOLDER_NAME/RMAN_LOGS
#5. $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET
#6. $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP
#7. $BACKUP_BASE/$FOLDER_NAME/CF_BACKUPSET
#8. $BACKUP_BASE/$FOLDER_NAME/CF_AUTOBACKUP
#9. $BACKUP_BASE/$FOLDER_NAME/COPY_DB
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=remitdb
export PATH=$PATH:$ORACLE_HOME/bin
export BACKUP_BASE=/flasharea/rman_backup/remitdb
export DATE_WITH_TIME=`date +%Y%m%d-%H%M%S`
export DATE_TIME=`date +%Y%m%d`
#export DATE_TIME=`date +%Y%m%d-%H%M%S`
export FOLDER_NAME="ARCH"_$DATE_TIME
############################# CREATING NECESSARY FOLDERS FOR BACKUP ####################################
#echo Starting Backup ...................................................................................
#echo `date +%m%d%Y-%H%M%S` >> $BACKUP_BASE/RMAN_LOGS/ARCH_""$DATE_TIME.log
echo Creating backup destination folders ................................................................
echo Creating backup destination folders $BACKUP_BASE/RMAN_LOGS for RMAN Log files history...............
mkdir -p $BACKUP_BASE/RMAN_LOGS
#echo Creating backup destination folders $BACKUP_BASE/LOGS for RMAN log files.................
#mkdir -p $BACKUP_BASE/LOGS
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/LOGS for RMAN log files.................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/LOGS
echo Creating Log file $BACKUP_BASE/$FOLDER_NAME/LOGS/ARCH_""$DATE_WITH_TIME.log for current operation
export LOG_FILE_NAME=$BACKUP_BASE/$FOLDER_NAME/LOGS/ARCH_""$DATE_WITH_TIME.log
touch $LOG_FILE_NAME
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP for archive log files..................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP
#echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET for DB Backupsets..........
#mkdir -p $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP for spfile....................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/CF_BACKUP for controlfile...............
mkdir -p $BACKUP_BASE/$FOLDER_NAME/CF_BACKUP
#echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/COPY_DB for RMAN copy of database.......
#mkdir -p $BACKUP_BASE/$FOLDER_NAME/COPY_DB
############################# FINISHED CREATING NECESSARY FOLDERS FOR BACKUP ##############################
$ORACLE_HOME/bin/rman target / nocatalog log = $LOG_FILE_NAME << EOF
run
{
ALLOCATE CHANNEL c1 DEVICE TYPE DISK MAXPIECESIZE 2G;
#ALLOCATE CHANNEL c2 DEVICE TYPE DISK MAXPIECESIZE 2G;
#ALLOCATE CHANNEL c3 DEVICE TYPE DISK MAXPIECESIZE 2G;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/CF_AUTO_%F';
#Retention policy to be defined by client
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
SQL "ALTER SYSTEM SWITCH LOGFILE";
###BACKUP AS BACKUPSET DATABASE FORMAT '$BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET/DB_%U';
#####BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES SKIP INACCESSIBLE;
#####BACKUP ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES SKIP INACCESSIBLE;
BACKUP ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES;
#Enable the DELETE command below on confirmation with client.
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 2 TIMES TO DISK;
BACKUP SPFILE FORMAT '$BACKUP_BASE/$FOLDER_NAME/SP_BACKUP/SP_%U';
BACKUP CURRENT CONTROLFILE FORMAT '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/CF_BS_%d_%u_%s_%T';
COPY CURRENT CONTROLFILE to '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/control01.ctl';
#CROSSCHECK BACKUP;
release channel c1;
#release channel c2;
#release channel c3;
}
exit;
EOF
cp $LOG_FILE_NAME $BACKUP_BASE/RMAN_LOGS
cp $ORACLE_HOME/dbs/initremitdb.ora $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP/initremitdb.ora
echo Backup RMAN log files: cp $LOG_FILE_NAME $BACKUP_BASE/RMAN_LOGS >> $LOG_FILE_NAME
echo 'End RMAN Backup of pigeon Database archives:' >> $LOG_FILE_NAME
date >> $LOG_FILE_NAME
#################################################################################
CURRENDIR=/home/oracle/zip
cd $CURRENDIR
rm $CURRENDIR/zipfiles 2>/dev/null
ls -1 *.zip
if [ $? -eq 0 ]
then
echo ".zip file found"
ls -1 $CURRENDIR/*.zip > $CURRENDIR/zipfiles
for i in `cat $CURRENDIR/zipfiles`
do
unzip $i
done
fi
if [ $? -eq 1 ]
then
echo "NOT found"
fi
###############################################################################
system-config-firewall-tui
system-config-network-tui
system-config-
How to install the desktop environment in unix environment ?
yum install gnome*
#############################################################################
yum Repositories
The
yum
command requires a repository as the source of the packages. If you are connected to the internet, you may choose to use the repository provided by your Linux distribution. In this case I am using Oracle Linux 6.x, so I could use the repository provided by Oracle (public-yum.oracle.com). If you have paid for RHEL support, you will register your server using the rhn_register
command, which will configure a yum repository.
You can also create a local repository from a distribution DVD, CD or iso file. To do this you will need to mount the DVD, CD or iso file
# mkdir /media/cdrom # # Mount physical/virtual cdrom/dvd # mount /dev/cdrom /media/cdrom # # Mount ISO image # mount -o loop /path/to/disk1.iso /media/cdrom
Next, you can do one of two things.
- Use the DVD directly as a Yum repository.
- Create a new Yum repository by copying the packages off the DVD.
To use the DVD directly, create a file called "/etc/yum.repos.d/dvd.repo" with the following contents, where the "baseurl" points to your DVD mount point.
[dvd] name=Oracle Linux Installation DVD baseurl=file:///media/cdrom enabled=0
Import the GPG key from the DVD.
# rpm --import /media/cdrom/RPM-GPG-KEY
You can now use the DVD as a Yum repository by referencing it using the "--enablerepo" option.
# yum install --enablerepo=dvd system-config-lvm
If you want to take the second option and create a new Yum repository by copying the packages off the DVD, create a local directory to hold the yum repository and copy the packages to it.
# mkdir /repo # cp /media/cdrom/Packages/* /repo
To create a repository, we need to install the
createrepo
package, which requires a couple of dependencies.# cd /repo # rpm -ivh deltarpm* python-deltarpm* # rpm -ivh createrepo*
Now we can create a repository out of the contents of the directory.
# cd /repo # createrepo .
To allow the
yum
command to use the repository, we must create a ".repo" file in the "/etc/yum.repos.d" directory. Create a file called "/etc/yum.repos.d/localrepo.repo" with the following contents.[localrepo] name=localrepo baseurl=file:///repo/ enabled=1 gpgcheck=0
Notice the "baseurl" parameter. This indicates the location of the repository. In this case I am using a local file system, so the parameter is set to "file://" followed by the path to the repository "/repo/". If this were an internet repository we would expect a baseurl with a HTTP address. For example, the Oracle Linux repository setting would be as follows.
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/2/base/$basearch/ gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
When using internet repositories, you typically expect the "gpgkey" entry as a security precaution.
You should now be able to use the
yum
command to install packages.
#########################################################################
RMAN SCRIPT for oracle database backup.
#Folders to create:
#1. $BACKUP_BASE=/flasharea/rman_backup/remitdb (Just an example)
#2. $BACKUP_BASE/ARCH_BACKUP
#3. $BACKUP_BASE/LOGS
#4. $BACKUP_BASE/$FOLDER_NAME/RMAN_LOGS
#5. $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET
#6. $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP
#7. $BACKUP_BASE/$FOLDER_NAME/CF_BACKUPSET
#8. $BACKUP_BASE/$FOLDER_NAME/CF_AUTOBACKUP
#9. $BACKUP_BASE/$FOLDER_NAME/COPY_DB
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=remitdb
export PATH=$PATH:$ORACLE_HOME/bin
export BACKUP_BASE=/flasharea/rman_backup/remitdb
export DATE_WITH_TIME=`date +%Y%m%d-%H%M%S`
export DATE_TIME=`date +%Y%m%d`
#export DATE_TIME=`date +%Y%m%d-%H%M%S`
export FOLDER_NAME="DB"_$DATE_TIME
############################# CREATING NECESSARY FOLDERS FOR BACKUP ####################################
#echo Starting Backup ...................................................................................
#echo `date +%m%d%Y-%H%M%S` >> $BACKUP_BASE/RMAN_LOGS/DB_""$DATE_TIME.log
echo Creating backup destination folders ................................................................
echo Creating backup destination folders $BACKUP_BASE/RMAN_LOGS for RMAN Log files history...............
mkdir -p $BACKUP_BASE/RMAN_LOGS
#echo Creating backup destination folders $BACKUP_BASE/LOGS for RMAN log files.................
#mkdir -p $BACKUP_BASE/LOGS
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/LOGS for RMAN log files.................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/LOGS
echo Creating Log file $BACKUP_BASE/$FOLDER_NAME/LOGS/DB_""$DATE_WITH_TIME.log for current operation
export LOG_FILE_NAME=$BACKUP_BASE/$FOLDER_NAME/LOGS/DB_""$DATE_WITH_TIME.log
touch $LOG_FILE_NAME
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP for archive log files..................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET for DB Backupsets..........
mkdir -p $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP for spfile....................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/CF_BACKUP for controlfile...............
mkdir -p $BACKUP_BASE/$FOLDER_NAME/CF_BACKUP
#echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/COPY_DB for RMAN copy of database.......
#mkdir -p $BACKUP_BASE/$FOLDER_NAME/COPY_DB
############################# FINISHED CREATING NECESSARY FOLDERS FOR BACKUP ##############################
$ORACLE_HOME/bin/rman target / nocatalog log = $LOG_FILE_NAME append << EOF
run
{
ALLOCATE CHANNEL c1 DEVICE TYPE DISK MAXPIECESIZE 2G;
#ALLOCATE CHANNEL c2 DEVICE TYPE DISK MAXPIECESIZE 2G;
#ALLOCATE CHANNEL c3 DEVICE TYPE DISK MAXPIECESIZE 2G;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/CF_AUTO_%F';
#Retention policy to be defined by client
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
SQL "ALTER SYSTEM SWITCH LOGFILE";
#####BACKUP AS BACKUPSET DATABASE FORMAT '$BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET/DB_%U';
BACKUP DATABASE FORMAT '$BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET/DB_%U';
#####BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT '$BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET/DB_%U';
BACKUP ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES SKIP INACCESSIBLE;
#####BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES SKIP INACCESSIBLE;
#Enable the DELETE command below on confirmation with client.
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 2 TIMES TO DISK;
BACKUP SPFILE FORMAT '$BACKUP_BASE/$FOLDER_NAME/SP_BACKUP/SP_%U';
BACKUP CURRENT CONTROLFILE FORMAT '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/CF_BS_%d_%u_%s_%T';
COPY CURRENT CONTROLFILE to '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/control01.ctl';
#CROSSCHECK BACKUP;
release channel c1;
#release channel c2;
#release channel c3;
}
exit;
EOF
cp $LOG_FILE_NAME $BACKUP_BASE/RMAN_LOGS
cp $ORACLE_HOME/dbs/initremitdb.ora $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP/initremitdb.ora
echo Backup RMAN log files: cp $LOG_FILE_NAME $BACKUP_BASE/RMAN_LOGS >> $LOG_FILE_NAME
echo 'End RMAN Backup of pigeon Database:' >> $LOG_FILE_NAME
date >> $LOG_FILE_NAME
exit
#########################################################################
RMAN SCRIPT for archive backup.
#Folders to create:
#1. $BACKUP_BASE=/flasharea/rman_backup/remitdb (Just an example)
#2. $BACKUP_BASE/ARCH_BACKUP
#3. $BACKUP_BASE/LOGS
#4. $BACKUP_BASE/$FOLDER_NAME/RMAN_LOGS
#5. $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET
#6. $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP
#7. $BACKUP_BASE/$FOLDER_NAME/CF_BACKUPSET
#8. $BACKUP_BASE/$FOLDER_NAME/CF_AUTOBACKUP
#9. $BACKUP_BASE/$FOLDER_NAME/COPY_DB
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=remitdb
export PATH=$PATH:$ORACLE_HOME/bin
export BACKUP_BASE=/flasharea/rman_backup/remitdb
export DATE_WITH_TIME=`date +%Y%m%d-%H%M%S`
export DATE_TIME=`date +%Y%m%d`
#export DATE_TIME=`date +%Y%m%d-%H%M%S`
export FOLDER_NAME="ARCH"_$DATE_TIME
############################# CREATING NECESSARY FOLDERS FOR BACKUP ####################################
#echo Starting Backup ...................................................................................
#echo `date +%m%d%Y-%H%M%S` >> $BACKUP_BASE/RMAN_LOGS/ARCH_""$DATE_TIME.log
echo Creating backup destination folders ................................................................
echo Creating backup destination folders $BACKUP_BASE/RMAN_LOGS for RMAN Log files history...............
mkdir -p $BACKUP_BASE/RMAN_LOGS
#echo Creating backup destination folders $BACKUP_BASE/LOGS for RMAN log files.................
#mkdir -p $BACKUP_BASE/LOGS
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/LOGS for RMAN log files.................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/LOGS
echo Creating Log file $BACKUP_BASE/$FOLDER_NAME/LOGS/ARCH_""$DATE_WITH_TIME.log for current operation
export LOG_FILE_NAME=$BACKUP_BASE/$FOLDER_NAME/LOGS/ARCH_""$DATE_WITH_TIME.log
touch $LOG_FILE_NAME
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP for archive log files..................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP
#echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET for DB Backupsets..........
#mkdir -p $BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP for spfile....................
mkdir -p $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP
echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/CF_BACKUP for controlfile...............
mkdir -p $BACKUP_BASE/$FOLDER_NAME/CF_BACKUP
#echo Creating backup destination folders $BACKUP_BASE/$FOLDER_NAME/COPY_DB for RMAN copy of database.......
#mkdir -p $BACKUP_BASE/$FOLDER_NAME/COPY_DB
############################# FINISHED CREATING NECESSARY FOLDERS FOR BACKUP ##############################
$ORACLE_HOME/bin/rman target / nocatalog log = $LOG_FILE_NAME << EOF
run
{
ALLOCATE CHANNEL c1 DEVICE TYPE DISK MAXPIECESIZE 2G;
#ALLOCATE CHANNEL c2 DEVICE TYPE DISK MAXPIECESIZE 2G;
#ALLOCATE CHANNEL c3 DEVICE TYPE DISK MAXPIECESIZE 2G;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/CF_AUTO_%F';
#Retention policy to be defined by client
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
SQL "ALTER SYSTEM SWITCH LOGFILE";
###BACKUP AS BACKUPSET DATABASE FORMAT '$BACKUP_BASE/$FOLDER_NAME/DB_BACKUPSET/DB_%U';
#####BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES SKIP INACCESSIBLE;
#####BACKUP ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES SKIP INACCESSIBLE;
BACKUP ARCHIVELOG ALL FORMAT '$BACKUP_BASE/$FOLDER_NAME/ARCH_BACKUP/ARCH_%U' NOT BACKED UP 2 TIMES;
#Enable the DELETE command below on confirmation with client.
DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 2 TIMES TO DISK;
BACKUP SPFILE FORMAT '$BACKUP_BASE/$FOLDER_NAME/SP_BACKUP/SP_%U';
BACKUP CURRENT CONTROLFILE FORMAT '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/CF_BS_%d_%u_%s_%T';
COPY CURRENT CONTROLFILE to '$BACKUP_BASE/$FOLDER_NAME/CF_BACKUP/control01.ctl';
#CROSSCHECK BACKUP;
release channel c1;
#release channel c2;
#release channel c3;
}
exit;
EOF
cp $LOG_FILE_NAME $BACKUP_BASE/RMAN_LOGS
cp $ORACLE_HOME/dbs/initremitdb.ora $BACKUP_BASE/$FOLDER_NAME/SP_BACKUP/initremitdb.ora
echo Backup RMAN log files: cp $LOG_FILE_NAME $BACKUP_BASE/RMAN_LOGS >> $LOG_FILE_NAME
echo 'End RMAN Backup of pigeon Database archives:' >> $LOG_FILE_NAME
date >> $LOG_FILE_NAME
#############################################################################
Linux Commands to check the open and listening ports :
To display open ports and established TCP connections, enter:
To display only open UDP ports try the following command:
If you want to see FQDN (full dns hostname), try removing the -n flag:
FreeBSD/OS X Unix user try the following command:
Sample outputs:
To check whether the port is open from client sides:
telnet ip port number
telnet 192.168.50.46 7001
Linux Commands to check the open and listening ports :
To display open ports and established TCP connections, enter:
$ netstat -vatn
To display only open UDP ports try the following command:
$ netstat -vaun
If you want to see FQDN (full dns hostname), try removing the -n flag:
$ netstat -vat
FreeBSD/OS X Unix user try the following command:
$ netstat -na | grep -i LISTEN
$ netstat -f inet -na | grep -i LISTEN
Sample outputs:
To check whether the port is open from client sides:
telnet ip port number
telnet 192.168.50.46 7001
Below is an Unix command to list all the IP addresses connected to your server on port 80.
netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head
netstat -tn 2>/dev/null
netstat -tn 2>/dev/null | grep :80
=======================================================================
[oracle@softdevdx3 dx3]$ cat /home/oracle/scripts/expPROD.sh
ORACLE_HOSTNAME=sofdevdx3.datec.com.pg; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DEV; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
WT_HOME=$ORACLE_BASE/product/Middleware/Oracle_WT1/instances/instance1; export WT_HOME
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$WT_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
#CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
CLASSPATH=$ORACLE_HOME/jdbc/lib/ojdbc5.jar:$CLASSPATH; export CLASSPATH
CLASSPATH=$CLASSPATH:/u01/install/apex/utilities; export CLASSPATH
export JAVA_HOME=/usr/bin
#declare -x ORACLE_SID=LAE
#cd /oradmp
#date +%Y-%m-%d-%H%M%S%P > dt
date +%a> dt
export DUMPFILE=prod_`cut -c 1-3 dt`
#echo $DUMPFILE
echo '-----------------------------------------------' >> /home/oracle/oradmp/PROD/export.log
echo `date +%Y/%m/%d-%H:%M` 'Start: '$DUMPFILE ' of PROD' >> /home/oracle/oradmp/PROD/export.log
exp parfile=/home/oracle/scripts/expPROD.ctl
echo `date +%Y/%m/%d-%H:%M` 'END : '$DUMPFILE ' of PROD' >> /home/oracle/oradmp/PROD/export.log
echo `date +%Y/%m/%d-%H:%M` 'Size : Kb' `ls -s /home/oracle/oradmp/PROD/$DUMPFILE.dmp` >> /home/oracle/oradmp/PROD/export.log
#echo '-----------------------------------------------' >> /home/oracle/oradmp/PROD/export.log
zip /home/oracle/oradmp/PROD/$DUMPFILE /home/oracle/oradmp/PROD/$DUMPFILE.dmp
======================================================================
#!/bin/bash
#cd /u01/install/apex/utilities
export APATH=/home/install/apex/utilities
cd $APATH
export JAVA_HOME=/usr/bin
CLASSPATH=/u01/app/oracle/product/11.2.0/db_1/jdbc/lib/ojdbc5.jar; export CLASSPATH
CLASSPATH=$CLASSPATH:$APATH; export CLASSPATH
#export CLASSPATH=$CLASSPATH:$APATH/oracle/apex
#apexexp {schema} {schemapw} {applno}
echo Exporting ........$3 >> $APATH/cronlog.log
#exec $JAVA_HOME/java -classpath $CLASSPATH oracle.apex.APEXExport -db 192.168.50.148:1521:dx3 -user $1 -password $2 -applicationid $3 &>/home/oracle/explog.log
exec $JAVA_HOME/java -classpath $CLASSPATH oracle.apex.APEXExport -db 192.168.50.148:1521:dx3 -user $1 -password $2 -applicationid $3 &>/home/oracle/explog.log
date +%a > dt
export OFILE=f$3-`cut -c 1-3 dt`.sql
echo Exported ........$OFILE >> $APATH/cronlog.log
#------now export and delete ----
cd $APATH
echo f$3.sql $OFILE
cp f$3.sql apexexp/$OFILE
[oracle@softdevdx3 dx3]$ cat /home/oracle/scripts/expPROD.sh
ORACLE_HOSTNAME=sofdevdx3.datec.com.pg; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DEV; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
WT_HOME=$ORACLE_BASE/product/Middleware/Oracle_WT1/instances/instance1; export WT_HOME
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$WT_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
#CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
CLASSPATH=$ORACLE_HOME/jdbc/lib/ojdbc5.jar:$CLASSPATH; export CLASSPATH
CLASSPATH=$CLASSPATH:/u01/install/apex/utilities; export CLASSPATH
export JAVA_HOME=/usr/bin
#declare -x ORACLE_SID=LAE
#cd /oradmp
#date +%Y-%m-%d-%H%M%S%P > dt
date +%a> dt
export DUMPFILE=prod_`cut -c 1-3 dt`
#echo $DUMPFILE
echo '-----------------------------------------------' >> /home/oracle/oradmp/PROD/export.log
echo `date +%Y/%m/%d-%H:%M` 'Start: '$DUMPFILE ' of PROD' >> /home/oracle/oradmp/PROD/export.log
exp parfile=/home/oracle/scripts/expPROD.ctl
echo `date +%Y/%m/%d-%H:%M` 'END : '$DUMPFILE ' of PROD' >> /home/oracle/oradmp/PROD/export.log
echo `date +%Y/%m/%d-%H:%M` 'Size : Kb' `ls -s /home/oracle/oradmp/PROD/$DUMPFILE.dmp` >> /home/oracle/oradmp/PROD/export.log
#echo '-----------------------------------------------' >> /home/oracle/oradmp/PROD/export.log
zip /home/oracle/oradmp/PROD/$DUMPFILE /home/oracle/oradmp/PROD/$DUMPFILE.dmp
======================================================================
#!/bin/bash
#cd /u01/install/apex/utilities
export APATH=/home/install/apex/utilities
cd $APATH
export JAVA_HOME=/usr/bin
CLASSPATH=/u01/app/oracle/product/11.2.0/db_1/jdbc/lib/ojdbc5.jar; export CLASSPATH
CLASSPATH=$CLASSPATH:$APATH; export CLASSPATH
#export CLASSPATH=$CLASSPATH:$APATH/oracle/apex
#apexexp {schema} {schemapw} {applno}
echo Exporting ........$3 >> $APATH/cronlog.log
#exec $JAVA_HOME/java -classpath $CLASSPATH oracle.apex.APEXExport -db 192.168.50.148:1521:dx3 -user $1 -password $2 -applicationid $3 &>/home/oracle/explog.log
exec $JAVA_HOME/java -classpath $CLASSPATH oracle.apex.APEXExport -db 192.168.50.148:1521:dx3 -user $1 -password $2 -applicationid $3 &>/home/oracle/explog.log
date +%a > dt
export OFILE=f$3-`cut -c 1-3 dt`.sql
echo Exported ........$OFILE >> $APATH/cronlog.log
#------now export and delete ----
cd $APATH
echo f$3.sql $OFILE
cp f$3.sql apexexp/$OFILE
========================================================================
No comments:
Post a Comment