Three methods for creating an Oracle database

Source: Internet
Author: User

1. Create, configure, or delete a Database by running Oracle Database Configuration Assistant (you can also enter dbca in the command line );
2. Create a database using command line
3. Create, configure, or delete a database by running a custom batch processing script (or create_ORACLE_SID.bat (create_ORACLE_SID. SQL.

Details:
1. Create, configure, or delete a Database by running Oracle Database Configuration Assistant;
It is recommended that DBAs who are not familiar with the creation process use this method. They only need to configure according to the option "Next", and finally generate the database creation script (recommended) or directly create a database;
Advantage: the GUI method is easy to use;
Disadvantage: the creation process is slow;

2. Create a database using command line
Copy codeThe Code is as follows:
CONNECT/AS SYSDBA
Startup pfile = 'C: oracleadmininit_testorcl.ora 'nomount;
Create database testOrcl DATAFILE '/u02/oracle/testOrcl/system01.dbf' SIZE 100 M
LOGFILE GROUP1 ('/u01/oracle/testOrcl/redo1a. log ',
'/U02/oracle/testOrcl/redo1b. log') SIZE 500 K,
GROUP2 ('/u01/oracle/testOrcl/redo1a. log ',
'/U02/oracle/testOrcl/redo1b. log') SIZE 500 K
Character set ZHS16CGB231280;

-- Directly convert the database from the never-built status to the open status
Alter database open;

-- Drop a Database)
Spool c: DROP_DATABASE.BAT
SELECT 'del '| NAME: deletes database-related data files from v $ DATAFILE;
SELECT 'del '| MEMBER deletes data and restructured the log file from v $ LOGFILE;
Spool off;

Advantage: You can familiarize yourself with the creation instructions and principles;
Disadvantage: the configuration is simple, and the command line commands must be memorized;
 
3. Run a custom batch processing or SQL script (create_ORACLE_SID.bat or create_ORACLE_SID. SQL) to create
Copy codeThe Code is as follows:
-- Create_ORACLE_SID.bat
Set ORACLE_SID = ORACLE_SID.
Del C: ORACLE8IdatabasepwdORACLE_SID.ora
C: ORACLE8Ibinoradim-new-sid ORACLE_SID.-intpwd oracle-startmode manual
-Pfile C: ORACLE8IadminORACLE_SIDpfileinit.ora
C: ORACLE8Ibinsvrmgrl @ C: WINNTProfilesAdministratorLbORACLE_SIDrun. SQL
C: ORACLE8Ibinsvrmgrl @ C: WINNTProfilesAdministratorLbORACLE_SIDrun1. SQL
C: ORACLE8Ibinoradim-edit-sid ORACLE_SID-startmode auto

-- ORACLE_SIDrun. SQL
Spool C: ORACLE8IadminORACLE_SIDcreatecreatedb
Set echo on
Connect INTERNAL/oracle
Startup nomount pfile = C: ORACLE8IadminORACLE_SIDpfileinit.ora
Create database ORACLE_SID
LOGFILE 'C: ORACLE8IoradataORACLE_SIDredo01.log 'SIZE 1024 K,
'C: ORACLE8IoradataORACLE_SIDredo02.log 'SIZE 1024 K
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXLOGHISTORY 1
DATAFILE 'C: oracle8ioradataoracle_sidsystem01.dbf' SIZE 50 M REUSE
MAXDATAFILES 254
MAXINSTANCES 1
Character set ZHT16BIG5
National character set ZHT16BIG5;
Spool off

-- ORACLE_SIDrun1. SQL
Spool C: ORACLE8IadminORACLE_SIDcreatecreatedb1
Set echo on
Connect INTERNAL/oracle
Alter database datafile 'C: oracle8ioradataoracle_sidsystem01.dbf' autoextend on;
Create rollback segment sysrol tablespace "SYSTEM" STORAGE (INITIAL 100 k next 100 K );
Alter rollback segment "SYSROL" ONLINE;

Oracle operations on Linux

The following operations on Oracle are performed on the Linux platform!
1. su Oracle
2. sqlplus/logon
3. connect test/test assysdba (test/test is an Oracle user and password)
4. startup
5. lsnrctl
Preferred database startup
Su-Oracle
Sqlplus/nolog
Conn/as sysdba
Startup
Then start the listener:
Go to/opt/Oracle/product/9.2.0/bin/
Lsnrctl start
Run the shudown command to close the database.
[Oracle @ wing/Oracle] $ sqlplus "/as sysdba" // log on to the database as a sysdba user
SQL> shutdown

Start Oracle 9i Database
[Oracle @ wing bin] $ sqlplus "/as sysdba"
SQL> startup

Start the Oracle 9i listener
Oracle listeners provide interfaces for client connection.
[Oracle @ wing bin] $ lsnrctl
LSNRCTL> start

Disable the Oracle 9i listener
[Oracle @ wing bin] $ lsnrctl
LSNRCTL> stop

Check whether the Oracle_SID environment variable is set correctly.
9i:
$ Sqlplus/nolog
SQL> connect/as sysdba
SQL> startup
$ Lsnrctl start
8i:
$ Svrmgrl
SVRMGR> connect internal
SVRMGR> startup
$ Lsnrctl start
Where is the error reported ??
Generally, you only need to set these two places ~
/Etc/oratab
Ora2:/Oracle/app/Oracle/product/8.1.7: Y
/Etc/inittab
Oralce: 2: wait:/bin/su-Oracle-c '/Oracle/app/Oracle/product/8.1.7/bin/lsnrctl start'
Oracle: 2: wait:/bin/su-Oracle-c '/Oracle/app/Oracle/product/8.1.7/bin/dbstart'

Start procedure:
Su-Oracle
[Oracle @ websvr1 Oracle] $ sqlplus/nolog
SQL> connect/as sysdba
SQL> startup
SQL> quit
[Oracle @ websvr1 Oracle] $ lsnrctl start
Use [Oracle @ websvr1 Oracle] $ lsnrctl status to check whether the listener has been started.

Close steps:
Su-Oracle
[Oracle @ websvr1 Oracle] $ lsnrctl stop
[Oracle @ websvr1 Oracle] $ sqlplus/nolog
SQL> connect/as sysdba
SQL> shutdown immediate
SQL> quit

Related Article

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.