Sponsored Content
Top Forums Shell Programming and Scripting Cold Backup of Oracle database. Post 302797327 by durden_tyler on Monday 22nd of April 2013 11:11:33 AM
Old 04-22-2013
Quote:
Originally Posted by javeedkaleem
...
This command is also doing same thing but printing spaces between.
...
If Perl is an option, then one way to fix this is -

Code:
$
$ # blank spaces exist between the characters "f" and "$"; the "$" represents the end of line
$ cat -vET a.txt
/data01/oracle/oradata/vas/data/system01.dbf                             $
/data01/oracle/oradata/vas/data/sysaux01.dbf                             $
/data01/oracle/oradata/vas/data/undotbs01.dbf                             $
/data01/oracle/oradata/vas/data/users01.dbf                             $
/data01/oracle/oradata/vas/data/users02.dbf                             $
/data01/oracle/oradata/vas/data/users03.dbf                             $
/data01/oracle/oradata/vas/data/xdb01.dbf                             $
$
$ perl -lne 's/\s*$//; ($x=$_)=~s|^.*/||; print "gzip -c \"$_\" > \"/backup/vas/$x.gz\""' a.txt
gzip -c "/data01/oracle/oradata/vas/data/system01.dbf" > "/backup/vas/system01.dbf.gz"
gzip -c "/data01/oracle/oradata/vas/data/sysaux01.dbf" > "/backup/vas/sysaux01.dbf.gz"
gzip -c "/data01/oracle/oradata/vas/data/undotbs01.dbf" > "/backup/vas/undotbs01.dbf.gz"
gzip -c "/data01/oracle/oradata/vas/data/users01.dbf" > "/backup/vas/users01.dbf.gz"
gzip -c "/data01/oracle/oradata/vas/data/users02.dbf" > "/backup/vas/users02.dbf.gz"
gzip -c "/data01/oracle/oradata/vas/data/users03.dbf" > "/backup/vas/users03.dbf.gz"
gzip -c "/data01/oracle/oradata/vas/data/xdb01.dbf" > "/backup/vas/xdb01.dbf.gz"
$
$

---------- Post updated at 11:11 AM ---------- Previous update was at 10:56 AM ----------

Alternatively, you could use the "tr" command to remove blank spaces and then pipe the output to an awk script.

Code:
$
$
$ tr -d " " < a.txt | awk -F'/' '{ print "gzip -c " $0 " >  /backup/"$NF".gz" }'
gzip -c /data01/oracle/oradata/vas/data/system01.dbf >  /backup/system01.dbf.gz
gzip -c /data01/oracle/oradata/vas/data/sysaux01.dbf >  /backup/sysaux01.dbf.gz
gzip -c /data01/oracle/oradata/vas/data/undotbs01.dbf >  /backup/undotbs01.dbf.gz
gzip -c /data01/oracle/oradata/vas/data/users01.dbf >  /backup/users01.dbf.gz
gzip -c /data01/oracle/oradata/vas/data/users02.dbf >  /backup/users02.dbf.gz
gzip -c /data01/oracle/oradata/vas/data/users03.dbf >  /backup/users03.dbf.gz
gzip -c /data01/oracle/oradata/vas/data/xdb01.dbf >  /backup/xdb01.dbf.gz
$
$

However, this will remove all spaces from the file, and not just the trailing spaces. Hopefully that is not a problem in your case.
 

6 More Discussions You Might Find Interesting

1. AIX

Cold backup

Hello, I am newbie IBM AIX.I am working on R12.1.1 O.S IBM AIX i want to take cold backup of 12.1.1 apps,db,inst folder with zip.Please tell me backup command with zip or any other utility.becauze i was using the tar -cvf command this command taking too much space for backup.please reply... (1 Reply)
Discussion started by: umair
1 Replies

2. Solaris

Can't create database after Oracle Database installation

I installed Oracle 10 software on Solaris 11 Express, everything was fine execpt I can't create database using dbca.rsp file. I populated file with following options. OPERATION_TYPE = "createDatabase" GDBNAME = "solaris_user.domain.com" SID = "solaris_user" TEMPLATENAME = "General... (0 Replies)
Discussion started by: solaris_user
0 Replies

3. Shell Programming and Scripting

script for backup database

Hello sir, i have used this for taking the database backup 5 * * * * \usr\bin\sh\mysqldump -h localhost -u username-ppassword cms> /home/dbbackup.sql. but it creates a zero size database and in mail it gives error like command not found. Please Help me (3 Replies)
Discussion started by: niva
3 Replies

4. Shell Programming and Scripting

Cold backup oracle and Restore to new db

Hello All, I am very new to Linux i have assignment to take offline backup in linux and restore it to new database oracle 10g? Help me out any script of it and steps i will be very thankful Regards, Sameer (0 Replies)
Discussion started by: sameer_123
0 Replies

5. UNIX for Dummies Questions & Answers

I need perl script on cold backup in Oracle 10 g

Hi , I am new to Perl script.Can u please provide me perl scripts for the following: 1. Perl script on Cold backup in Oracle 10g 2.Perl script on Hot backup in Oracle 10g (0 Replies)
Discussion started by: Niharika Srivas
0 Replies

6. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies
smd-server(1)						 Sync Mail Dir (smd) documentation					     smd-server(1)

NAME
smd-server - sends diffs and mails to smd-client SYNOPSIS
smd-server [--exclude glob] [-v|--verbose] [-d|--dry-run] [--get-mddiff-cmdline] [--stop-after-diff] [--override-db dbf] [--dump-stdin tgt] endpoint mailboxes DESCRIPTION
smd-server needs to know a name (endpoint) for the client (that must not be used by others) and a list of mailboxes (directories). smd-server first calls mddiff(1), then prints on stdout the generated diff. It then accepts from stdin a small set of commands a client may issue to request a file (or parts of it, like the header). smd-server is in charge of committing the db file used by mddiff(1) in case the client communicates a successful sync. OPTIONS
-v --verbose Increase program verbosity (printed on stderr) -d --dry-run Do not perform any action for real -n --no-delete Do not track deleted files --exclude glob Exclude paths matching glob --override-db dbf Use dbf as the db-file --get-mddiff-cmdline Print the command line used for mddiff and then exist --stop-after-diff Send the actions to the other endpoint and exit. If used in conjunction with --override-db, dbf is removed just before exiting --dump-stdin tgt Dump standard input to tgt and exit NOTES
smd-server is a low level utility. You should use higher level tools like smd-pull(1) and smd-push(1) SEE ALSO
mddiff(1), smd-client(1), smd-pull(1), smd-push(1) AUTHOR
Enrico Tassi <gares@fettunta.org> 11 June 2012 smd-server(1)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy