| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Avoid repeat Password entry in Setup script?
"Robert Wagner" <RobertWagner_at_alum.mit.edu> wrote in message
news:XRo65.10874$9E6.62150_at_newsr1.maine.rr.com...
> I have a single batch file which (1) creates a user, (2) imports a
database
> structure for that user, and (3) creates some synonyms for that user's
> tables, procedure package, and views.
>
> My problem is this: I'd like to find a way for the installing person to
> enter the password for the user only ONCE. Right now, (s)he has to enter
it
> 3 times:
> 1) When creating the user
> 2) When importing the structure, and
> 3) When creating the synonyms.
>
> Here's how I now do it:
> =================
> The top level batch file contains:
>
> REM SET UP THE MYDATA USER ACCOUNT:
> CALL SUPPORTING\CREAT_MYUSER.BAT
> REM IMPORT THE MYDATA STRUCTURE:
> IMP80 PARFILE=SUPPORTING\IMPORMYSTRUCT.TXT
> REM CREATE THE SYNONYMNS:
> CALL SUPPORTING\CREATE_SYNONYMS.BAT
> -----------
> In the subdirectory "SUPPORTING", the files are
>
> CREAT_MYUSER.BAT:
> PLUS80 /nologin @SUPPORTING/CREATE_MYUSER.SQL
>
> CREATE_MYUSER.SQL:
> -- Create the user MYNAME
> ACCEPT INSTALLER PROMPT 'Please enter your Oracle User Name:'
> DEFINE USERPROMPT = 'Please Enter Password for &INSTALLER';
> ACCEPT IPSWD PROMPT '&USERPROMPT' HIDE;
> CONNECT &INSTALLER/&IPSWD_at_MYNAME.WORLD
> DEFINE MYOWNER = 'MYNAME';
> DEFINE USERPROMPT = 'Please Enter Password for &MYOWNER';
> ACCEPT OPSWD PROMPT '&USERPROMPT' HIDE;
> SET VERIFY OFF;
> PROMPT CREATING USER &MYOWNER;
> SET ECHO OFF;
> CREATE USER &MYOWNER IDENTIFIED BY &OPSWD;
> SET ECHO ON;
> SET VERIFY ON;
> GRANT CONNECT, IMP_FULL_DATABASE, RESOURCE, CREATE TRIGGER,
> CREATE VIEW TO &MYOWNER ;
> EXIT
>
> IMPORMYSTRUCT.TXT:
> USERID=MYNAME FROMUSER=MYNAME TOUSER=MYNAME
> FILE=SUPPORTING/ORMYSTRUCT.DMP LOG=MYNOTFULLIMPLOG.TXT
>
> ORMYSTRUCT.DMP (not shown here)
>
> CREATE_SYNONYMS.BAT
> plus80 MYNAME @SUPPORTING/SYNONYMS.SQL
> SYNONYMS.SQL:
> -- This is a 'pared down' version, just to give the idea
> CREATE PUBLIC SYNONYM TBLMYJOBS FOR MYNAME.TBLMYJOBS;
> CREATE PUBLIC SYNONYM PK_SUBS FOR MYNAME.PK_SUBS;
> CREATE PUBLIC SYNONYM TOP_VIEW FOR MYNAME.TOP_VIEW;
> exit
> ==========
> Is there a way of avoiding the password entries for the import and create
> synonyms processes?
>
> TIA >> Robert
>
>
>
>
>
>
>
>
First of all, IMO, there isn't a real valid reasons why the synonyms are
created *after* the import. You could definitely have one sqlplus session in
which you start
several scripts. As the synonyms are public synonyms they need to be created
only once per database and they don't require the user to be known prior to
creation.
Secondly, the new user definitely doesn't need IMP_FULL_DATABASE privilege,
you should avoid that.
Thirdly you can set environment variables in NT and they *will* work in
sql*plus. So
SET PASSWD=...
SET UNAM=...
sqlplus ...
create user %UNAM% identified by %PASSWD%
should work.
Hth,
Sybrand Bakker, Oracle DBA Received on Wed Jun 28 2000 - 00:00:00 CDT
![]() |
![]() |