Pass sql into pl/sql and create RMAN duplicate script.


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I'm new to pl/sql and I'm trying to write a script that will generate some RMAN commands to do a database clone.

I want to able to run the script and it prompt me for variables to be used in the script.

I've done some research but I've been unable to find any examples of how to do this.

Basic script is (there would obviously be a lot more to the final script):

declare

dbname varchar2(9) := &dbname;

BEGIN
DBMS_OUTPUT.ENABLE(2000);
DBMS_OUTPUT.PUT_LINE(' DUPLICATE TARGET DATABASE TO '|| dbname ||';');
end;
/

Gives me:

Enter value for dbname: ORCL4
old 3: dbname varchar2(9) := &dbname;
new 3: dbname varchar2(9) := ORCL4;
dbname varchar2(9) := ORCL4;
*
ERROR at line 3:
ORA-06550: line 3, column 24:
PLS-00201: identifier 'ORCL4' must be declared
ORA-06550: line 3, column 9:
PL/SQL: Item ignored
ORA-06550: line 7, column 66:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 7, column 9:
PL/SQL: Statement ignored

Thanks,

No comments posted yet

Your Answer:

Login to answer
277 Like 49 Dislike
Previous forums Next forums
Other forums

Anti Spam Code
Ok where do i start? Probably by telling you I have very little working knowledge of PHP and that I

Form help: Syntax & Logic
Hello again all,

I'm working on a form and ran into a wall (again) and can't seem to think th

Finding digits in variable containing text, and IDing them
$romanstock = "http://www.remoteprice.com/data.asp?storeid=123&itemcode=456&typ

Do not allow posting of whitespace
Currently the script below works if the user does not type a name/message, but if i create a whitesp

breaking a text file into paragraphs based on strings
I have a text file of email addresses that is all squished together. It looks like this:

abc

imap: how to save a copy of sent emails to sent elements
Hello my friends,

I am writing an online emailing application with inbox outbox/sent elements

Asset Transfer from One plant to another within same company code
Hi,

Please advise how to transfer one asset from one plant to another plant within same c

Php mysql - select?
Hi i have this code:
Code: $iteminfo = mysql_query("SELECT desc FROM wc_items WHERE itemid =

[function.file]: failed to open stream: No such file or directory
Okay I wrote this little script to upload a csv file that is located on my webhosts server to a mysq

Get relative path from absolute path
How would one go about getting the relative path to a file from its absolute path?

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash