Re: Clone Database user [message #518444 is a reply to message #518247] |
Wed, 03 August 2011 23:52 |
|
dkdms2124
Messages: 369 Registered: April 2010 Location: INDIA
|
Senior Member |
|
|
Hi All,
Below is the content of the batch file without using network link:
set /P Service_Name=Enter the Service_Name of Database:
sqlplus scott1/tiger@'%Service_Name%' @copy_user_sql.sql
echo ******Ready to Export the Data of OLD_USER******
echo ================================================
set /P Old_UserName=Enter Old Username:
set /P New_UserName=Enter New Username:
set /P FileName=Enter Dumpfile Name:
set /P ServiceName=Enter Service Name:
expdp scott1/tiger@'%ServiceName%' file='%FileName%.dmp' directory=DATA_PUMP_DIR logfile='%FileName%_exp.log' schemas=%Old_UserName% exclude=statistics
echo ******Ready to Import Data into NEW_USER******
echo ================================================
impdp scott1/tiger@'%ServiceName%' file='%FileName%.dmp' directory=DATA_PUMP_DIR logfile='%FileName%_imp.log' REMAP_SCHEMA= %Old_UserName%:%New_UserName%
cmd
Below are the parameter that you have to input:
Old Username. [ Username whose copy you want to make.]
New Username. [ New User in which the data will be copied.]
Service Name. [Service name of the database.]
Datapump Directory.[In my case I have taken the default directory][DATA_PUMP_DIR]
You can modify the parameters and the script accordingly as per you requirement.
The script which I have used mentioned in the second line as "@copy_user_sql.sql", have got from the internet which clones a user and grant even all the object level privileges (EXACT CPOY) to the user.
Thanks n Regards
Deepak
[Updated on: Wed, 03 August 2011 23:56] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Clone Database user [message #518482 is a reply to message #518453] |
Thu, 04 August 2011 01:48 |
|
dkdms2124
Messages: 369 Registered: April 2010 Location: INDIA
|
Senior Member |
|
|
Now I want to create a dump table in which should contain the name of the "New_User" created from this script only with name of "Old_User" from whom it was created and date-time.
So whenever this batch file is run and a user is created, the information should send to this dummy table.
Regards
Deepak
[Updated on: Thu, 04 August 2011 01:51] Report message to a moderator
|
|
|
|
|
|