Miscellaneous however important commands used in UNIX/Linux environments. |
- netstat
- 'tar' command
- tape archive scripts
|
|
1. netstat |
|
Netstat command examples: |
|
# netstat -a | more
# netstat -at
# netstat -au
# nestat -an | grep
# netstat -ap | grep
# netstat -lx
# netstat -ie
# netstat -r
|
|
|
2. 'tar' command |
|
Good practice for compressing a file is to archive the files first and then compress them. So to create an archive of a disk archive that contains a group of files or an entire directory , we should use the tar utility. Another advantage of the tar is that it also compresses the file to some extent. So using tar with gzip means double layer compression. To use the tar we should need to know some of its options: |
|
c: (c)reate an archive x: e(x)tract from an archive t: lis(t) the files in archive f: (f)ile instead of tape |
|
# tar cvzf $ORACLE_HOME
# tar -zxvf weekly_bkp.tar.gz
# tar -cvf cold_rman.tar cold/ rman/
# tar -xvf cold_rman.tar
# tar -cf archive.tar myDirectories/
# tar -tf archive.tar
# tar -xf archive.tar
# tar -xf archive.tar
# tar -xf dbuat01_bkp.tar rman/dbuat01_controlfile_trace.txt
# tar -czvf archive.tgz cold/ rman/
# tar -zxvf cold_rman.tgz
# find . -type d -mtime -7 | xargs tar -rf weekly_backup.tar
# gzip weekly_backup.tar
# tar -zxvf weekly_backup.tar.gz
# tar -cvzf
# tar -cvzf jpg_archive.tar.gz /path/to/images/*.jpg
# gunzip jpg_archive.tar.gz
# tar -xvf jpg_archive.tar
# tar cvf - cold/ rman/ | gzip > dbuat01_bkp.tar.gz
|
|
|
3. tape archive scripts |
|
The following script will archive a backup location to media tapes: |
|
#!/bin/ksh
export log_loc="/u02/backup/logs/dbuat01_rman_bkp_logs"
echo 'DBUAT01 DAILY RMAN BACKUP'
cd /
date > `date "+$log_loc/dbuat01_cold_rman_bkp_%d_%h_20%y_%H_%M_start_time"`
tar -cvf /dev/rmt0 /u02/oradata/dbuat01/backup/cold/ /u02/oradata/dbuat01/backup/rman/
date > `date "+$log_loc/dbuat01_cold_rman_bkp_%d_%h_20%y_%H_%M_end_time"`
date > `date "+$log_loc/dbuat01_cold_rman_bkp_%d_%h_20%y_%H_%M_verify_start_time"`
tar -tvf /dev/rmt0 > `date "+$log_loc/dbuat01_cold_rman_bkp_%d_%h_20%y_%H_%M_contents_list"`
date > `date "+$log_loc/dbuat01_cold_rman_bkp_%d_%h_20%y_%H_%M_verify_end_time"`
exit |
|
Another example: |
|
#!/bin/ksh
log_loc="/u02/backup/logs/dbuat01_rman_bkp_logs"
export log_loc
echo 'DAILY RMAN BACKUP OF DBUAT01'
cd /
date > `date "+$log_loc/%d_%h_20%y_%H_%M_DBUAT01_Daily_Bkp_Start_Time"`
tar -cvf /dev/rmt2 /u02/oradata/backup/dbuat01/
date > `date "+$log_loc/%d_%h_20%y_%H_%M_DBUAT01_Daily_Bkp_Stop_Time"`
date > `date "+$log_loc/%d_%h_20%y_%H_%M_DBUAT01_Daily_Bkp_Verify_Start_Time"`
tar -tvf /dev/rmt2 > `date "+$log_loc/%d_%h_20%y_%H_%M_DBUAT01_Daily_Bkp_Contents_List"`
date > `date "+$log_loc/%d_%h_20%y_%H_%M_DBUAT01_Daily_Bkp_Verify_End_Time"`
exit
|
|
[ Top ] |
|
Last modified: Jul 05, 2012 11:45 IST |
No comments:
Post a Comment