Home » Infrastructure » Windows » Create DB Script (Oracle 12c on Server 2012R2 standard)
Create DB Script [message #647574] Wed, 03 February 2016 02:11 Go to next message
Yud_m
Messages: 14
Registered: January 2012
Location: Israel
Junior Member
Hello,
I am trying to make a script to add Databases.
Each time the Database name should come from a parameter.
I generated a script but it it is not working.

Attached is the batch and the errors:

C:\ora>C:\oracle\product\12.1.0\dbhome_1\bin\oradim.exe -edit -sid DB_name
rtmode auto -srvcstart system

C:\ora>C:\oracle\product\12.1.0\dbhome_1\bin\sqlplus /nolog @C:\oracle\admin
saas4\scripts\intsaas4.sql

SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 1 12:18:15 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

SP2-0310: unable to open file "C:\oracle\admin\DB_name\scripts\intsaas4.sql
SQL>

Thank you
Yudit
  • Attachment: DB_new.txt
    (Size: 0.79KB, Downloaded 134 times)
Re: Create DB Script [message #647575 is a reply to message #647574] Wed, 03 February 2016 02:23 Go to previous messageGo to next message
John Watson
Messages: 7183
Registered: January 2010
Location: Global Village
Senior Member
THis sounds like a shell scripting problem, rather than an Oracle problem. You might want to go to a Windows forum instead of here.

However, to get any help you need to show what actually happens when you run the script. Use copy/paste from a cmd prompt window, and please enclose the text in [code] tags, as described here, How to use [code] tags and make your code easier to read What you have posted so far does not make it clear what command line arguments you are passing to the script.


[Updated on: Wed, 03 February 2016 02:24]

Report message to a moderator

Re: Create DB Script [message #647576 is a reply to message #647574] Wed, 03 February 2016 02:24 Go to previous messageGo to next message
gazzag
Messages: 906
Registered: November 2010
Location: Bristol, UK
Senior Member
What does the following yield?
C:\> dir C:\oracle\admin\DB_name\scripts
Re: Create DB Script [message #647577 is a reply to message #647576] Wed, 03 February 2016 02:30 Go to previous messageGo to next message
Yud_m
Messages: 14
Registered: January 2012
Location: Israel
Junior Member
Hi,

set verify off
ACCEPT sysPassword CHAR PROMPT 'Enter new password for SYS: ' HIDE
ACCEPT systemPassword CHAR PROMPT 'Enter new password for SYSTEM: ' HIDE
host C:\oracle\product\12.1.0\dbhome_1\bin\orapwd.exe file=C:\oracle\product\12.1.0\dbhome_1\database\PWD%1.ora force=y format=12
@C:\oracle\admin\%1\scripts\CloneRmanRestore.sql
@C:\oracle\admin\%1\scripts\cloneDBCreation.sql
@C:\oracle\admin\%1\scripts\plug_PDBSeed.sql
@C:\oracle\admin\%1\scripts\postScripts.sql
@C:\oracle\admin\%1\scripts\lockAccount.sql
@C:\oracle\admin\%1\scripts\postDBCreation.sql
@C:\oracle\admin\%1\scripts\PDBCreation.sql
@C:\oracle\admin\%1\scripts\plug_intsaas3.sql
@C:\oracle\admin\%1\scripts\postPDBCreation_intsaas3.sql

Sad
Yudit
Re: Create DB Script [message #647578 is a reply to message #647576] Wed, 03 February 2016 02:32 Go to previous messageGo to next message
John Watson
Messages: 7183
Registered: January 2010
Location: Global Village
Senior Member
Is it not amazing how some people refuse all offers of assistance?
Re: Create DB Script [message #647579 is a reply to message #647578] Wed, 03 February 2016 02:48 Go to previous messageGo to next message
Yud_m
Messages: 14
Registered: January 2012
Location: Israel
Junior Member
Sorry I am not an expert Sad
Re: Create DB Script [message #647580 is a reply to message #647579] Wed, 03 February 2016 02:53 Go to previous messageGo to next message
gazzag
Messages: 906
Registered: November 2010
Location: Bristol, UK
Senior Member
gazzag wrote on Wed, 03 February 2016 08:24
What does the following yield?
C:\> dir C:\oracle\admin\DB_name\scripts
Re: Create DB Script [message #647581 is a reply to message #647579] Wed, 03 February 2016 02:59 Go to previous messageGo to next message
John Watson
Messages: 7183
Registered: January 2010
Location: Global Village
Senior Member
Quote:
you need to show what actually happens when you run the script
Re: Create DB Script [message #647585 is a reply to message #647580] Wed, 03 February 2016 04:38 Go to previous messageGo to next message
Yud_m
Messages: 14
Registered: January 2012
Location: Israel
Junior Member
C:\>dir C:\oracle\admin\intsaas4\scripts
Volume in drive C has no label.
Volume Serial Number is 4294-966F

Directory of C:\oracle\admin\intsaas4\scripts

02/02/2016 11:54 AM <DIR> .
02/02/2016 11:54 AM <DIR> ..
01/31/2016 09:46 AM 1,808 cloneDBCreation.
01/31/2016 09:46 AM 842 CloneRmanRestore
02/01/2016 08:08 AM 722 intsaas4.sql
01/31/2016 12:51 PM 545 lockAccount.sql
01/31/2016 12:50 PM 86 PDBCreation.sql
01/31/2016 12:50 PM 633 plug_intsaas3.sq
01/31/2016 12:49 PM 2,313 plug_PDBSeed.sql
01/31/2016 12:49 PM 854 postDBCreation.s
01/31/2016 09:46 AM 458 postPDBCreation_
01/31/2016 12:47 PM 1,935 postScripts.sql
10 File(s) 10,196 bytes
2 Dir(s) 101,950,902,272 bytes free
Re: Create DB Script [message #647586 is a reply to message #647585] Wed, 03 February 2016 04:41 Go to previous messageGo to next message
Michel Cadot
Messages: 65252
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

@Yud_m

Please read How to use [code] tags and make your code easier to read.

Re: Create DB Script [message #647587 is a reply to message #647585] Wed, 03 February 2016 04:45 Go to previous messageGo to next message
gazzag
Messages: 906
Registered: November 2010
Location: Bristol, UK
Senior Member
So is your database name intsaas4 or "DB_Name". Your posts are not consistent. You have to show us a complete session from start to finish by Copying & Pasting it here.
Re: Create DB Script [message #647589 is a reply to message #647574] Wed, 03 February 2016 06:35 Go to previous message
EdStevens
Messages: 863
Registered: September 2013
Senior Member
Yud_m wrote on Wed, 03 February 2016 02:11
Hello,
I am trying to make a script to add Databases.
Each time the Database name should come from a parameter.
I generated a script but it it is not working.

Attached is the batch and the errors:

C:\ora>C:\oracle\product\12.1.0\dbhome_1\bin\oradim.exe -edit -sid DB_name
rtmode auto -srvcstart system

C:\ora>C:\oracle\product\12.1.0\dbhome_1\bin\sqlplus /nolog @C:\oracle\admin
saas4\scripts\intsaas4.sql


In the last line above, you appear to be telling sqlplus to execute a script named 'intsaas4.sql', located in directory C:\oracle\admin\saas4\scripts.
It also appears you did not copy and paste, but transcribed, as - even allowing for autoatic line wrap, you are missing the '\' between 'admin' and 'saas4'. Therefore the above, as you've presented it is not even a valid sqlplus command line.

Quote:

SQL*Plus: Release 12.1.0.2.0 Production on Mon Feb 1 12:18:15 2016

Copyright (c) 1982, 2014, Oracle. All rights reserved.

SP2-0310: unable to open file "C:\oracle\admin\DB_name\scripts\intsaas4.sql
SQL>


but the error message indicates you told sqlplus to execute intsaas4.sql, located at 'C:\oracle\admin\DB_name\scripts\'
This is not the same location you indicated at the supposed command line you showed us. So from that we know without a doubt that you are not using copy and paste to show us exactly what you did and exactly what resulted. Therefore, we can't really trust anything you showed us.

Also, if you have installed Oracle, then the directory "C:\oracle\product\12.1.0\dbhome_1\bin" should already be in your PATH and it is not necessary to fully qualify the names of your executables.
For example, instead of

C:\ora>C:\oracle\product\12.1.0\dbhome_1\bin\oradim.exe -edit -sid DB_name
rtmode auto -srvcstart system

C:\ora>C:\oracle\product\12.1.0\dbhome_1\bin\sqlplus /nolog @C:\oracle\admin
saas4\scripts\intsaas4.sql

you can specify simply

C:\ora>oradim.exe -edit -sid DB_name
rtmode auto -srvcstart system

C:\ora>sqlplus /nolog @C:\oracle\admin\saas4\scripts\intsaas4.sql


And none of this has anything to do with knowing Oracle. It is all fundamental pc knowledge ....


Previous Topic: No OLE DB
Next Topic: Error ORA-12505 tns listener does not currently know of sid given in connect descriptor
Goto Forum:
  


Current Time: Wed Dec 13 05:23:10 CST 2017

Total time taken to generate the page: 0.02356 seconds