To create a database using the Create DB statement

Source: Internet
Author: User
Tags sqlplus

This article refers to the way in which the database was created using create databases in chapter II of the Administrator ' s Guide. In general, the first thing we get in touch with is the creation of a database using DBCA, which is more complex than creating databases.

-----------------------------------------------------------------------------------------

The following steps are required to create a database using the Create Databases command:

Step 1: Specify the instance identifier

Export ORACLE_SID=MYNEWDB


Step 2: Set the relevant environment variables

Oracle_home and Oracle_sid must specify that the path variable is optional

Export Oracle_home=/u01/app/oracle/product/11.2.0/db_1

Export path= $PATH: $ORACLE _home/bin


Step 3: Select the authentication method for the database administrator

The database administrator's authentication method has the password file authentication and the operating system authentication.

Password file authentication: a password is required when creating a password file.

Operating system authentication: joins the user to the DBA group.


Step 4: Create a static parameter file

You can copy a static parameter file from another database, or you can create a parameter file by modifying a sample of the initialization parameters.

The three parameter values of Db_name, Control_files, and Memory_target must be specified.

The static parameter file is named Initsid.ora.

[email protected] dbs]$ CP Init.ora Initmynewdb.ora

Note: The sample parameter file has not been modified too much because it is just a test. Note that the corresponding directory in the parameter file should be built.


Step 5: Connect to the database

How to connect the password file as authentication mode:

[Email protected] mynewdb]$ Sqlplus/nolog

Sql> CONNECT SYS as SYSDBA

How to connect using the operating system authentication method

$ sqlplus/nolog

Sql> Connect/as SYSDBA


Step 6: Create a dynamic parameter file

CREATE SPFILE from PFILE; #这一步可放在以后执行


Step 7: Launch the instance

STARTUP Nomount


Step 8: Issue the CREATE DATABASE directive

CREATE DATABASE mynewdb

USER SYS identified by ASD

USER SYSTEM identified by ASD

LOGFILE GROUP 1 ('/app/oracle/oradata/mynewdb/redo01a.log ', '/app/oracle/oradata/mynewdb/redo01b.log ') SIZE 100M BLOCKSIZE 512,

GROUP 2 ('/app/oracle/oradata/mynewdb/redo02a.log ', '/app/oracle/oradata/mynewdb/redo02b.log ') SIZE 100M BLOCKSIZE 512,

GROUP 3 ('/app/oracle/oradata/mynewdb/redo03a.log ', '/app/oracle/oradata/mynewdb/redo03b.log ') SIZE 100M BLOCKSIZE 512

Maxlogfiles 5

Maxlogmembers 5

Maxloghistory 1

Maxdatafiles 100

CHARACTER SET Al32utf8

National CHARACTER SET AL16UTF16

EXTENT MANAGEMENT LOCAL

DataFile '/app/oracle/oradata/mynewdb/system01.dbf ' SIZE 325M reuse

Sysaux datafile '/app/oracle/oradata/mynewdb/sysaux01.dbf ' SIZE 325M reuse

DEFAULT tablespace Users

DataFile '/app/oracle/oradata/mynewdb/users01.dbf '

SIZE 500M Reuse autoextend on MAXSIZE UNLIMITED

DEFAULT Temporary tablespace tempts1

Tempfile '/app/oracle/oradata/mynewdb/temp01.dbf '

SIZE 20M Reuse

UNDO tablespace UNDOTBS1

DataFile '/app/oracle/oradata/mynewdb/undotbs01.dbf '

SIZE 200M Reuse autoextend on MAXSIZE UNLIMITED;


Step 9: Create additional Tablespace

CREATE tablespace Apps_tbs LOGGING

DataFile '/app/oracle/oradata/mynewdb/apps01.dbf '

SIZE 500M Reuse autoextend on NEXT 100M MAXSIZE UNLIMITED

EXTENT MANAGEMENT LOCAL;

--Create a tablespace for indexes, separate from user tablespace (optional)

CREATE tablespace Indx_tbs LOGGING

DataFile '/app/oracle/oradata/mynewdb/indx01.dbf '

SIZE 100M Reuse autoextend on NEXT 10M MAXSIZE UNLIMITED

EXTENT MANAGEMENT LOCAL;


Step 10: Run the script to build the data dictionary view

Performed by a user with SYSDBA permissions:

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc.sql

@?/rdbms/admin/utlrp.sql

Execute with System user

@?/sqlplus/admin/pupbld.sql


Step 11: Back Up the database

The database can be switched to the archive mode for Rman backup.

-------------------------------------------------------------------------------------------



This article is from the "three countries Cold jokes" blog, please be sure to keep this source http://myhwj.blog.51cto.com/9763975/1889503

To create a database using the Create DB statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.