xtremely minimal manual oracle database creation script

15
XTREMELY minimal manual Oracle database creation script 1. Set your ORACLE_SID export ORACLE_SID=test export ORACLE_HOME=/path/to/oracle/home 2. Create a minimal init.ora # $ORACLE_HOME/dbs/init<sid>.ora control_files = (/path/to/control1.ctl,/path/to/control2.ctl,/path/to/contro l3.ctl) undo_management = AUTO undo_tablespace = UNDOTBS1 db_name = test db_block_size = 8192 sga_max_size = 1073741824 #one gig sga_target = 1073741824 #one gig 3. Create a password file $ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5

Upload: wotaradeska

Post on 10-Apr-2015

100 views

Category:

Documents


3 download

DESCRIPTION

XTREMELY Minimal Manual Oracle Database Creation Script

TRANSCRIPT

Page 1: XTREMELY Minimal Manual Oracle Database Creation Script

XTREMELY minimal manual Oracle database creation script

1. Set your ORACLE_SID

export ORACLE_SID=test

export ORACLE_HOME=/path/to/oracle/home

2. Create a minimal init.ora

# $ORACLE_HOME/dbs/init<sid>.ora control_files = (/path/to/control1.ctl,/path/to/control2.ctl,/path/to/control3.ctl)undo_management = AUTOundo_tablespace = UNDOTBS1db_name = testdb_block_size = 8192sga_max_size = 1073741824 #one gigsga_target = 1073741824 #one gig

3. Create a password file

$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5

4. Start the instance

sqlplus / as sysdba

startup nomount

Page 2: XTREMELY Minimal Manual Oracle Database Creation Script

5. Create the database

create database testlogfile group 1 ('/path/to/redo1.log') size 100M, group 2 ('/path/to/redo2.log') size 100M, group 3 ('/path/to/redo3.log') size 100Mcharacter set WE8ISO8859P1national character set utf8datafile '/path/to/system.dbf' size 500M autoextend on next 10M maxsize unlimited extent management localsysaux datafile '/path/to/sysaux.dbf' size 100M autoextend on next 10M maxsize unlimitedundo tablespace undotbs1 datafile '/path/to/undotbs1.dbf' size 100Mdefault temporary tablespace temp tempfile '/path/to/temp01.dbf' size 100M;

Note: there's some other things you can do here, like "ARCHIVELOG" "SET TIME_ZONE =" and "USER SYS IDENTIFIED BY password" and "USER SYSTEM IDENTIFIED BY password"

6. Run catalog and catproc

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc.sql

7. Change passwords

alter user sys identified by whatever;

alter user system identified by whatever;OMF: minimal manual Oracle create database syntax

1. Set your ORACLE_SID

export ORACLE_SID=test

Page 3: XTREMELY Minimal Manual Oracle Database Creation Script

export ORACLE_HOME=/path/to/oracle/home

2. Create a minimal init.ora

# $ORACLE_HOME/dbs/init<sid>.ora control_files = (/path/to/control1.ctl,/path/to/control2.ctl,/path/to/control3.ctl)undo_management = AUTOdb_name = test

Page 4: XTREMELY Minimal Manual Oracle Database Creation Script

db_block_size = 8192

sga_max_size = 1073741824 #one gigsga_target = 1073741824 #one gigdb_create_file_dest = /path/to/datafile/location #OMFdb_create_online_log_dest_1 = /path/to/first/redo_and_control_file/location #OMF

Page 5: XTREMELY Minimal Manual Oracle Database Creation Script

db_create_online_log_dest_2 = /path/to/second/redo_and_control_file/location #OMFdb_recovery_file_dest = /path/to/flash/recovery/area #OMF#note it’s a good idea to also have background_dump_dest, user_dump_dest, and core_dump_dest here as well

3. Create a password file

$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5

4. Start the instance

sqlplus / as sysdba

Page 6: XTREMELY Minimal Manual Oracle Database Creation Script

startup nomount

5. Create the database

Page 7: XTREMELY Minimal Manual Oracle Database Creation Script

create database testcharacter set WE8ISO8859P1national character set utf8undo tablespace undotbs1default temporary tablespace temp;

You can even do this and it will work, the ultimate in minimalism:

create database test;

Note: There's some other things you can do here, like "ARCHIVELOG" "SET TIME_ZONE =" and "USER SYS IDENTIFIED BY password" and "USER SYSTEM IDENTIFIED BY password"

Note 2: This is so minimal because you are using Oracle Managed Files as seen in #2

6. Run catalog and catproc

Page 8: XTREMELY Minimal Manual Oracle Database Creation Script

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc.sql

Standard create Oracle database syntax

After creating your init.ora file with the appropriate parameters you can use the "create database" command in SQL*Plus to create a database:

Make sure that your have your $ORACLE_HOME and $ORACLE_SID set properly and that you sign-on as SYSDBA:

startup nomount;

CREATE CONTROLFILE REUSE DATABASE "OLDLSQ" NORESETLOGSNOARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 2MAXDATAFILES 240MAXINSTANCES 1MAXLOGHISTORY 113LOGFILEGROUP 1 ('/u03/oradata/oldlsq/log1a.dbf','/u03/oradata/olslsq/log1b.dbf') SIZE 30M,GROUP 2 ('/u04/oradata/oldlsq/log2a.dbf','/u04/oradata/oldlsq/log2b.dbf') SIZE 30MDATAFILE

Page 9: XTREMELY Minimal Manual Oracle Database Creation Script

'/u01/oradata/oldlsq/system01.dbf',

'/u01/oradata/oldlsq/mydatabase.dbf';

Page 10: XTREMELY Minimal Manual Oracle Database Creation Script

This is just an abbreviated sample of the Oracle create database command and there are many more options:

clone/copy oracle with create database command

Oracle 10g Automated create database DBCA

Oracle9i DBCA Database Creation Assistant Templates

RAC Grid Oracle Database Creation with DBCA

Oracle TipsDavid Ellison: Heir to the Oracle throne?Oracle whistleblower asking for $42,000,000 payday2010 Oracle Offshoring declared a disaster2010 Oracle layoffs may exceed 10,000Do you have what it takes to be an emergency DBA?

Oracle performance tuning software

Oracle performance Tuning 10g reference poster

Page 11: XTREMELY Minimal Manual Oracle Database Creation Script

Oracle training in Linux commands Oracle training Excel Oracle training & performance tuning books

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals. Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Page 12: XTREMELY Minimal Manual Oracle Database Creation Script

Errata? Oracle technology is changing and we strive to update our BC Oracle support information. If you find an error or have a suggestion for improving our content, we would appreciate your feedback. Just e-mail: and include the URL for the page.

Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services

Page 13: XTREMELY Minimal Manual Oracle Database Creation Script

Copyright © 1996 - 2010 by Burleson Enterprises, Inc.

All rights reserved.

Oracle © is the registered trademark of Oracle Corporation.

Page 14: XTREMELY Minimal Manual Oracle Database Creation Script