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

Windows Authentication
I have a website which is windows authenticated.
now i want something more on this application.<

value not going in data base
hello friends....
i am having a working javascript....when i am selecting any

How to display random record from table?
I have the following code:

Code: <?php
$display_block .= "<input type=

Why is the logic of this simple code not working?
Hey, I'm trying to determine if a table already exists in mysql, but doing a query first with mysql_

Using Curl_multi for processing multiple URLs
Hi,

I am at a loss as to how to implement this. I would like to be able to automatically assi

Not "Just Another" MMORPG - text based.
Hello,

I've been learning MySQL and PHP for the last 2-3 years.
Though, I've had long paus

simple script won't work. Please help
I'm new to php, and I am having trouble displaying a simple script in my web browser. My php code ex

Session is not saving
I am not trying to do anything too fancy, I am just trying to get some $_SESSION data to save and us

weeks in a year
hi,

i found this snippet on php.net
QuoteFor the week number for weeks starting on Sunday:

Add 5 to a variable when a button is clicked, and re-run a for loop
So I'm making a feedback sort of section on a website with MySQL and PHP, I've gotten the script to

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