Home » Other » Client Tools » Create new database in SQL Plus or PowerShell
Create new database in SQL Plus or PowerShell [message #628771] Fri, 28 November 2014 05:37 Go to next message
pturner87
Messages: 3
Registered: November 2014
Location: United Kingdom
Junior Member
Hi guys, I'm very new to Oracle and I have a question about creating a new database.

I'm investigating this at work because our software relies on a database which can be either SQL Server or Oracle, and we have set up provisioning for the whole system using PowerShell. The provisioning only supports SQL Server at the moment hence my question.

I've installed Oracle 12c Enterprise and chose the "install database software only" option. I've spent some time googling how to create a new database from this starting point, using SQL Plus or anything else that can run through PowerShell but I haven't figured it out yet. Can anyone please point me in the right direction?

I think I'll try setting up a database using Universal Installer just to see what files it creates; I think this is one of my problems i.e. the lack of a tnsnames.ora, and I can't even log into SQL Plus because I don't think a user name and password was set up in the Oracle installation.

Sorry if I seem completely clueless about this. Any help would be greatly appreciated.
Re: Create new database in SQL Plus or PowerShell [message #628779 is a reply to message #628771] Fri, 28 November 2014 06:57 Go to previous messageGo to next message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
Oracle provides a couple of other utilities to do what you want.

First, Oraclue Universal Installer (OUI) only installs the software. It does not create a database. Some people THINK it does because if make a selection to let it do so, it will (after installing the software) invoke the next utility ...

'dbca' (Database Configuration Assistant) is a GUI tool that will create a database after the software is installed.

You can configure your tnsnames.ora with another GUI tool, 'netca'.

None of what you want to achieve will be as simple as copying some files (implied by your statement "I think I'll try setting up a database using Universal Installer just to see what files it creates;".

If you need to script everything so as to not need to rely on an interactive process, you can make one run of dbca. At the end it will give you the option to simply generate the necessary scripts for creating the database. If you then need for those script to not have hard-coded database names, you can replace the hard-coded values with some identifiable tag, and work out a method of global search and replace on those tags.

In fact, make two trial runs. Once, selecting a 'generic' template (you'll see what I mean when you get there) and the other with a 'custom' template. Compare the scripts put out by the two.

For tnsnames.ora, use netca. Again, if you need a 'generic', replace the hard-coded values in the generated file will identifieable tags and proceed accordingly.
Re: Create new database in SQL Plus or PowerShell [message #628785 is a reply to message #628779] Fri, 28 November 2014 07:33 Go to previous messageGo to next message
pturner87
Messages: 3
Registered: November 2014
Location: United Kingdom
Junior Member
Thanks for the advice Ed, I'll have a look at dbca and netca and see if I can figure it out.
Re: Create new database in SQL Plus or PowerShell [message #628804 is a reply to message #628785] Fri, 28 November 2014 09:14 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Well, basically you can also create a database without any of those tools manually

See Creating a Database with the CREATE DATABASE Statement.

The scripts that dbca and the other tools create can be used in that process, but it might be a good idea to try it with a "simple" hand-crafted database first to get some insights into the process.
Re: Create new database in SQL Plus or PowerShell [message #628811 is a reply to message #628804] Fri, 28 November 2014 09:42 Go to previous messageGo to next message
pturner87
Messages: 3
Registered: November 2014
Location: United Kingdom
Junior Member
I ran through dbca creating a database again, but I don't see an option to generate the scripts. Are they created automatically and stored somewhere?
Re: Create new database in SQL Plus or PowerShell [message #628812 is a reply to message #628811] Fri, 28 November 2014 09:51 Go to previous messageGo to next message
John Watson
Messages: 8919
Registered: January 2010
Location: Global Village
Senior Member
Go through the DBCA dialogue again. Right at the end you get a window with check boxes for creating the database and/or creating the scripts.
Re: Create new database in SQL Plus or PowerShell [message #628813 is a reply to message #628811] Fri, 28 November 2014 09:52 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
pturner87 wrote on Fri, 28 November 2014 07:42
I ran through dbca creating a database again, but I don't see an option to generate the scripts. Are they created automatically and stored somewhere?


usually a screen appears with radio buttons for you to select

make database
make scripts
make both
Re: Create new database in SQL Plus or PowerShell [message #636884 is a reply to message #628813] Tue, 05 May 2015 03:23 Go to previous messageGo to next message
browncat
Messages: 9
Registered: May 2015
Junior Member
This is how you can create database in SQL plus....and then use it...

CREATE DATABASE db;
USE db;

[Updated on: Tue, 05 May 2015 03:24]

Report message to a moderator

Re: Create new database in SQL Plus or PowerShell [message #636887 is a reply to message #636884] Tue, 05 May 2015 03:31 Go to previous messageGo to next message
Michel Cadot
Messages: 68618
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

USE is not an Oracle command.

Re: Create new database in SQL Plus or PowerShell [message #636910 is a reply to message #636884] Tue, 05 May 2015 07:54 Go to previous message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
browncat wrote on Tue, 05 May 2015 03:23
This is how you can create database in SQL plus....and then use it...

CREATE DATABASE db;
USE db;


Is archeology your hobby? This thread had been dormant for over 5 months ....
Previous Topic: Importing data in csv file . . .
Next Topic: Tool for tracking SQLs in Oracle 11g
Goto Forum:
  


Current Time: Tue Mar 19 06:23:51 CDT 2024