Operating System - HP-UX
1751694 Members
5023 Online
108781 Solutions
New Discussion юеВ

How to create a database and perform transaction

 
SOLVED
Go to solution
Deanna Tran
Frequent Advisor

How to create a database and perform transaction

I would like to know if anyone can show me the script on how to create a database and how to perform transaction as well?
9 REPLIES 9
Sukant Naik
Trusted Contributor

Re: How to create a database and perform transaction

Your question seems to be unclear.

If you are interested in ANY database then download the source of Berkley DB and use it.

Or you can source of MySQL and install it.

- Sukant
Who dares he wins
Wodisch
Honored Contributor
Solution

Re: How to create a database and perform transaction

Hello Deanna,

in general terms you will need a "create database ...;" statement, once, and every transaction has to be followed by "commit;" (well,, or "rollback;" in case you do not like it ;-)

But if you tell us for which product you need it, we can be more specific!

Regards,
Wodisch
Deanna Tran
Frequent Advisor

Re: How to create a database and perform transaction

Hello Wodisch

I can't get my script to create the database...
here is the script that I use, and also these are the errors that I get when I run the script
@/u02/create_db.sql
Connected.
ORA-01081: cannot start already-running ORACLE - shut it down first
SP2-0734: unknown command beginning "This creat..." - rest of line ignored.
Maxinstance 1
*
ERROR at line 3:
ORA-02165: invalid option for CREATE DATABASE


Alter rollback segment rbs_temp online
*
ERROR at line 1:
ORA-01109: database not open
Alter rollback segment rbs02 online
*
ERROR at line 1:
ORA-01109: database not open


Alter rollback segment rbs03 online
*
ERROR at line 1:
ORA-01109: database not open


Alter rollback segment rbs04 online
*
ERROR at line 1:
ORA-01109: database not open


Alter rollback segment rbs05 online
*
ERROR at line 1:
ORA-01109: database not open

Storage ( initial 1M next 1M optimal 100M minextends 20 maxextends unlimited)
*
ERROR at line 2:
ORA-02143: invalid STORAGE option


Storage ( initial 1M next 1M optimal 100M minextends 20 maxextends unlimited)
'/u02/oradata/sales/sales_tools01.dbf size 100M reuse
*
ERROR at line 2:
ORA-01756: quoted string not properly terminated


SP2-0734: unknown command beginning "Creating 3..." - rest of line ignored.
(initial 40K next 40K *cincrease 50 minextends 1 maxextends 505)
ERROR at line 3:
ORA-02143: invalid STORAGE option


(initial 40K next 40K *cincrease 50 minextends 1 maxextends 505)
ERROR at line 3:
ORA-02143: invalid STORAGE option


(initial 40K next 40K *cincrease 5
Rok Doltar
Frequent Advisor

Re: How to create a database and perform transaction

Hi,

I cannot access your attached script. Please check it yourself.

I suspect that you have some comment starting as "This creat" in your script, that is not properly written. All other errors can be result of this wrong line.

Best regards,
Rok
benoit Bruckert
Honored Contributor

Re: How to create a database and perform transaction

hi,
The trouble is the first error (ORA-...)
Are you sure to have the ORACLE_SID set ?
If it's not the cas do it with the proper SID.
And if you have another database running on the same server, with the same ORACLE_SID then caution !!
If you have a previously database with this SID set which is running and you want to remove it, then shut it down first before the create !!

hope it may help
Une application mal pans├йe aboutit ├а une usine ├а gaze (GHG)
Andreas D. Skjervold
Honored Contributor

Re: How to create a database and perform transaction

Hi again Deanna.
So your still strugling with your databases...
Can access your script, but this is a start:

First; have you created and started and database earlier. Check with "ps -ef |grep pmon". If you get any ora_pmon_ processes, then you have databases with the given SID.
If you want to create a new database with your script, make sure you set a different ORACLE_SID in your enviroment than the one(s) already in use. Then run your script.

Second there seems to be a number of error in the script. Most of the error are due to the fact that the database already was running, as you can't recreate it..

>SP2-0734: unknown command
This is most probably remarks in the script that you have forgotten to put an # sign in front of.

>Maxinstance 1
This is spelled wrong: "maxinstances 1"

>Storage ( initial 1M next 1M optimal 100M minextends 20 maxextends unlimited)
This is spelled wrong:
Storage ( initial 1M next 1M optimal 100M minextents 20 maxextents unlimited)

>'/u02/oradata/sales/sales_tools01.dbf size 100M reuse
This lacks the last "'" should read:
'/u02/oradata/sales/sales_tools01.dbf' size 100M reuse

>(initial 40K next 40K *cincrease 50 minextends 1 maxextends 505)
This is spelled wrong:
>(initial 40K next 40K pctincrease 50 minextents 1 maxextents 505)

Hope this helps on your database creation.

For your transaction, you'll need a table to enter data into. Use the "create table" statement.
Further enter data using "insert into" statement.
End the transaction using "commit;"
To read data from teh table use "select * from tablename;"

Good luck

Andreas
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
Andreas D. Skjervold
Honored Contributor

Re: How to create a database and perform transaction

I'm struggling as well...
Should be:
CAN'T access your script...
Only by ignoring what everyone think is important, can you be aware of what everyone ignores!
Jack C. Mahaffey
Super Advisor

Re: How to create a database and perform transaction

I will typically create at least x files in the .../admin//create directory for the database creation scripts and x files in the ../admin//pfile directory.

Here's the steps I typically follow:

Step 1 - Create parameter that points to ../admin directory named $ORACLE_ADMIN
Step 2 - Create directories under $ORACLE_ADMIN/
adhoc/scripts
bdump
cdump
pfile
create
udump

Step 3 - Create necessary directories to hold datafiles, control files, redo logs, archive logs, etc.. e.g. /u01/oradata/, /u02/oraarchive/, /u03/orabackup/ ...

Step 4 - Create at least 4 db create files in $ORACLE_ADMIN//create
a. createdb.sql - Issues create db statement

b. createdbenv.sql - Creates system rollback setment. Runs catalog.sql and catproc.sql scripts. Creates RBS, TEMP, TOOLS, USERS tablespaces. Creates Rollback segments. Runs catdbsyn.sql and pupbld.sql scripts.

c. createts.sql - Creates application tablespaces.

d. createus.sql - Creates application users.

Step 5 - Create at least 3 db parameter startup files in $ORACLE_ADMIN//pfile
a. config.ora - Contains location of control files, archive logs, user trace files, block size and database name.
b. init.ora - Contains database parameters used during normal operation.
c. config_setup.ora - Used only during database creation. Does not list rollback segments, has archiving off,...

Step 6 - Make sure that oracle owns all files and directories.

Step 7 - Add oracle sid to $ORACLE_HOME/network/admin/tnsnames.ora and listener.ora.

Step 8 - Update /etc/oratab

Step 9 - Restart oracle listener.

Step 10 - Change to $ORACLE_ADMIN//create directory.

Step 10 - Logon to Oracle, export ORACLE_SID= and start svrmgrl.

Step 11 - Execute createdb.sql

Step 12 - Execute createdbenv.sql

Step 13 - Execute createts.sql

Step 14 - Execute createus.sql

Step 15 - Shutdown the database.

Step 16 - Create a symbolic link in $ORACLE_HOME/dbs/init.orato the init.ora file in $ORACLE_ADMIN//pfile/.
e.g. ln -s $ORACLE_ADMIN//pfile/init.ora $ORACLE_HOME/dbs/init.ora

Step 17 - Create a password file.
e.g. passwd file=/u01/app/oracle/product/7.3.4/dbs/orapw password= entries=10

Step 18 - Update $ORACLE_ADMIN//pfile/init/ora to meet your requirements. Determine if you need online archiving and want to use the sysdba role.

Step 19 - Restart svrmgrl and start the database. Online archiving will require starting the database the first time in mount and executing alter database archivelog and alter database open.

Step 20 - Verify startup... If everything looks okay, shutdown the database and backup all your files before restarting database.


I'm placing copies of some of the files that I've identified into a single file. Files are separated by the following string "===FILE==="



jack...




Wodisch
Honored Contributor

Re: How to create a database and perform transaction

Hello Deanna,

as long as we have that problem (broken attachments),
if you want to, email me your script or ask for an example of an Create-an-Oracle-Instance-under-HPUX-from-scratch script...

Regards,
Wodisch
PS: read my "profile" for the eMail-address...