Sunteți pe pagina 1din 3

Create Database

• export ORACLE_SID=myfirstdb

• Create initSID.ora file and place it in $ORACLE_HOME/dbs

db_block_size=2048
db_name=sdb
background_dump_dest=/u01/app/oracle/admin/shekhardb/bdump
core_dump_dest=/u01/app/oracle/admin/shekhardb/cdump
user_dump_dest=/u01/app/oracle/admin/shekhardb/udump
control_files=("/opt/oradata/shekhardb/control01.ctl",
"/opt/oradata/shekhardb/control02.ctl",
"/opt/oradata/shekhardb/control03.ctl")
compatible=10.2.0.1.0
processes=50
sga_target=120M
audit_file_dest=/u01/app/oracle/admin/shekhardb/adump
pga_aggregate_target=25M
undo_management=AUTO
undo_tablespace=UNDOTBS

[oracle@oracledb dbs]$ Sqlplus / as sysdba

SQL>startup nomount;

SQL>CREATE DATABASE sdb


2 controlfile reuse
3 Maxinstances 1
4 Maxloghistory 1
5 Maxlogfiles 10
6 Maxlogmembers 4
7 Maxdatafiles 100
8 Datafile '/opt/oradata/shekhardb/system01.dbf' size 100M
9 character set WE8MSWIN1252
11 noarchivelog
12 logfile
13 group 1 ('/opt/oradata/shekhardb/redo_01.log') size 10M,
14 group 2 ('/opt/oradata/shekhardb/redo_02.log') size 10M
15 undo tablespace UNDOTBS datafile
'/opt/oradata/shekhardb/undotbs_01.dbf' size 20M
16 default temporary tablespace TEMP
17* tempfile '/opt/oradata/shekhardb/temp_01.dbf' size 20M;
Database will be created, mounted and opened

• Sql.bsq is used by create database command. It will create the


following things in the database.

• The SYSTEM tablespace


• A rollback segment named SYSTEM in the SYSTEM tablespace
• The SYS and SYSTEM user accounts
• The dictionary base tables and clusters
• Indexes on dictionary tables and sequences for dictionary use
• The roles PUBLIC, CONNECT, RESOURCE, DBA, DELETE_CATALOG_ROLE,
EXECUTE_CATALOG_ROLE, and SELECT_CATALOG_ROLE
• The DUAL table

• Run the following scripts

SQL> @/u01/app/oracle/product/10.1.0/db_1/rdbms/admin/catalog.sql
SQL> @/u01/app/oracle/product/10.1.0/db_1/rdbms/admin/catproc.sql

Catalog.sql runs the following scripts

• standard.sql Creates a package called STANDARD, which contains the


SQL functions to implement basic language features
• cataudit.sql Creates data dictionary views to support auditing
• catexp.sql Creates data dictionary views to support import/export
• catldr.sql Creates data dictionary views to support direct-path load
of SQL*Loader
• catpart.sql Creates data dictionary views to support partitioning
• catadt.sql Creates data dictionary views to support Oracle objects
and types
• catsum.sql Creates data dictionary views to support Oracle summary
management

catproc.sql creates data dictionary views required for PL/SQL

From the name of a script, you can sometimes identify its purpose. The
following list indicates the categories of scripts.
• cat*.sql Catalog and data dictionary scripts
• dbms*.sql PL/SQL administrative package definitions
• prvt*.plb PL/SQL administrative package code, in wrapped(encrypted)
form

• uNNNNNN.sql Database upgrade/migration scripts


• dNNNNNN.sql Database downgrade scripts
• utl*.sql Additional tables and views needed for database utilities

SQL> Alter user sys identified by difficult_password;


SQL> Alter user system identified by difficult_password;

SQL> create tablespace users datafile ‘/opt/oradata/shekhardb/user01.dbf’


size 30M;

SQL> create user shekhar identified by mypass default tablespace users


temporary tablespace temp;

SQL> grant dba to shekhar;

S-ar putea să vă placă și