Tuesday, February 3, 2009

sql statements from rman prompt

One of the major advantage of rman utility is we can issue sql commands also from rman prompt.
As it is required for us from rman prompt as we may want to switch a logfile or archive all non archived logfiles or take a tablespace offline/online etc.
So, it is a major advantage to do all this things from rman only. NO need of opening another sql session for this.

Note: though we can issue almost all the sql commands from rman , but any sql commands will not return anything to the rman prompt. Means , select statements will not echo anything to rman prompt.

so, let us check the exmaples:

1) type "SQL" then followed by sql statement inside single quotes followed by ";"

RMAN> SQL 'alter system archive log current';

sql statement: alter system archive log current

with that if you issue any wrong sql statement , you will receive an error here.

2) let us check a select statement
RMAN> sql 'select * from v$database';

sql statement: select * from v$database

As you can see here, the statement has executed but result has not been echoed to rman prompt

3) we can issue sql command from run block also . (same way)

4) if you are using sinegle quotes in your sql statement then follow the following way:

RMAN> SQL "create tablespace ershad
datafile ' ' c:\database\datafile\test01.dbf ' '
size 10m";

That is the entire statement should be inside double quotes (") and the single quote phase should be inside another single quote.

5) STILL MORE ..............................

you can execute pl/sql blocks also in the same format in rman prompt.

sql ' begin ...... .........; .........; end; ' ;

Hope this will help you out.

Thanks ,
have a nice day

If you do not hope, you will not find what is beyond your hopes.
St. Clement of Alexandra


Anonymous said...

Ηuгrаh! After all I got a webpagе
fгоm where I know how to actually get helpful information regardіng my study and knowlеdge.

Have a lοok at my ωeb pagе; famous wedding photographers
my webpage: wedding photographer prices

Anonymous said...

My spouse and I absolutely love your blog and find most of your post's to be precisely what I'm looking for.
Do you offer guest writers to write content to suit
your needs? I wouldn't mind publishing a post or elaborating on most of the subjects you write regarding here. Again, awesome weblog!

Here is my blog post - voyance gratuite

Anonymous said...

Very goοd info. Lucky me I diѕcovered your wеbsite by
chаnce (stumbleupon). I have saved as a favοritе for

My web site :: meuble de salle de bain

Anonymous said...

Good day! This post couldn't be written any better! Reading this post reminds me of my previous room mate! He always kept chatting about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing!

Also visit my webpage :: Roland Garros

Anonymous said...

Attractive section of content. I just stumbled
upon your website and in accession capital to assert that I
acquire actually enjoyed account your blog posts.
Any way I will be subscribing to your feeds and even I achievement you access consistently

Here is my weblog; voyance par mail

Anonymous said...

Hey! This post could not be written any better!
Reading through this post reminds me of my old
room mate! He always kept talking about this. I will forward this post to him.
Pretty sure he will have a good read. Thank you for sharing!

my web page; voyance par telephone (www.Irisvoyance.com)