Home » Infrastructure » Unix » backup Controlfile to trace (Oracle 10g, HP-UX)
backup Controlfile to trace [message #436781] Mon, 28 December 2009 05:21 Go to next message
pokhraj_d
Messages: 117
Registered: December 2007
Senior Member
Hi All,

I have created trace file by using below command:-
=================
SQL > alter database backup controlfile to trace;

Does anybody have a script to parse this control file backup?
that is, i need to create a neat script that contains just

STARTUP NOMOUNT
CREATE CONTROLFILE...
...
...
CHARACTER SET JA16SJIS;

Can someone share it with me ??

Regards-
Pokhraj
Re: backup Controlfile to trace [message #436786 is a reply to message #436781] Mon, 28 December 2009 05:56 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Just have a look at the file and use your favorite Unix tools: awk, sed, grep, head, tail and so on.
This is no more an Oracle question.

Regards
Michel
Re: backup Controlfile to trace [message #436787 is a reply to message #436781] Mon, 28 December 2009 05:59 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
##shamelessly stolen in bits & pieces from Google.
oracle@atana#perl -ne 'print unless ((/^#/) or (/^--/)); exit if (/^;/);' < ctrl.sql



STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "CHUM" NORESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/u01/data/chum/redo01.log'  SIZE 50M,
  GROUP 2 '/u01/data/chum/redo02.log'  SIZE 50M,
  GROUP 3 '/u01/data/chum/redo03.log'  SIZE 50M

DATAFILE
  '/u01/data/chum/system01.dbf',
  '/u01/data/chum/sysaux01.dbf',
  '/u01/data/chum/undotbs01.dbf',
  '/u01/data/chum/users01.dbf'
CHARACTER SET WE8MSWIN1252
;

[Updated on: Mon, 28 December 2009 06:02]

Report message to a moderator

Re: backup Controlfile to trace [message #436796 is a reply to message #436781] Mon, 28 December 2009 06:32 Go to previous messageGo to next message
pokhraj_d
Messages: 117
Registered: December 2007
Senior Member
Hi,

Thanx for the solution. Only one confusion:-
do I need to insert the below command at the shell script?

"perl -ne 'print unless ((/^#/) or (/^--/)); exit if (/^;/);' < ctrl.sql"

Forgot to post. I am using Shell script.

Please advice.

Regards-
Pokhraj

[Updated on: Mon, 28 December 2009 06:37]

Report message to a moderator

Re: backup Controlfile to trace [message #436798 is a reply to message #436796] Mon, 28 December 2009 06:37 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
If you want. It is not going to change anything.
This is just a perl one-liner.
Re: backup Controlfile to trace [message #437060 is a reply to message #436796] Wed, 30 December 2009 13:45 Go to previous message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Just another option:

awk '/^STARTUP/{g=1} g; /^;/{exit}' ctrl.sql | awk NF

Previous Topic: Need to set the kernel config file
Next Topic: Telnet configuration
Goto Forum:
  


Current Time: Fri Mar 29 00:01:01 CDT 2024