Database manually built Library

Source: Internet
Author: User
Tags create directory reserved create database sqlplus

1: Configure environment variables (below is the configuration of this lab environment)

[email protected] ~]$ cat. Bash_profile
#. Bash_profile

# Get the aliases and functions
If [-f ~/.BASHRC]; Then
. ~/.bashrc
Fi

# User specific environment and startup programs

Path= $PATH: $HOME/bin

Export PATH

Export Oracle_base=/u01/app/oracle
Export Oracle_home= $ORACLE _base/product/11.2.0/dbhome_1
Export Oracle_sid=prod
Export path= $PATH: $HOME/bin: $ORACLE _home/bin
Export Ld_library_path= $ORACLE _home/lib:/lib:/usr/lib

[Email protected] ~]$
--Make the environment variable effective, of course, if you re-login or do a switchover, and so on, this step can be omitted
[Email protected] ~]$. . bash_profile
[Email protected] ~]$

2: Create password file (function: Allow remote password to login to the database as SYSDBA, password file is optional)

--Switch to the directory where the password files are stored
[Email protected] ~]$ CD $ORACLE _home/dbs
[Email protected] dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[[email protected] dbs]$ ls
Init.ora
[Email protected] dbs]$
--command to generate a password file, help information
[Email protected] dbs]$ orapwd
Usage:orapwd file=<fname> entries=<users> force=<y/n> ignorecase=<y/n> nosysdba=<y/n>

where
File-name of password file (required),
Password-password for SYS would is prompted if not specified at command line,
Entries-maximum number of distinct DBA (optional),
Force-whether to overwrite existing file (optional),
Ignorecase-passwords is case-insensitive (optional),
Nosysdba-whether to shut out of the SYSDBA logon (optional Database Vault only).

There must be no spaces around the equal-to (=) character.
[Email protected] dbs]$
--Generate password file, password file format: Orapw+sid
[Email protected] dbs]$ orapwd File=orapwprod password=oracle
[[email protected] dbs]$ ls
Init.ora Orapwprod
[Email protected] dbs]$

3: Generate Pfile File

[Email protected] dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[[email protected] dbs]$ ls
Init.ora Orapwprod
[email protected] dbs]$ cat Init.ora |grep-v ^#|grep-v ^$ > Initprod.ora
[[email protected] dbs]$ ls
Init.ora Initprod.ora Orapwprod
[Email protected] dbs]$
[Email protected] dbs]$ VI Initprod.ora

Db_name= ' PROD '
memory_target=1g
processes = 150
--Note To verify this path, the next time you create a directory, the same
Audit_file_dest= '/u01/app/oracle/admin/prod/adump '
#audit_trail = ' db '
--Comment out the audit parameters, remove this function, DBCA build the library, is enabled by default.
db_block_size=8192
Db_domain= "
--Close the quick recovery area
#db_recovery_file_dest = ' <oracle_base>/flash_recovery_area '
--Close the quick recovery area and modify the parameters at any time if it needs to be turned on.
#db_recovery_file_dest_size =2g
--Comment out the parameters of the diagnostic, and when the database is created, this parameter is automatically enabled
#diagnostic_dest = ' <ORACLE_BASE> '
Dispatchers= ' (protocol=tcp) (SERVICE=ORCLXDB) '
open_cursors=300
Remote_login_passwordfile= ' EXCLUSIVE '
--undo tablespace name, name to match when creating database
Undo_tablespace= ' UNDOTBS1 '
--Modify the name and location of the control file
Control_files = (/U01/APP/ORACLE/ORADATA/PROD/ORA_CONTROL1.CTL,/U01/APP/ORACLE/ORADATA/PROD/ORA_CONTROL2.CTL)
compatible = ' 11.2.0 '

4: Create directory Adump directory and control file directory according to Pfile

[Email protected] ~]$ mkdir-p $ORACLE _base/admin/prod/adump
[Email protected] ~]$ mkdir-p $ORACLE _base/oradata/prod/
[Email protected] ~]$

5: Create SPFile with Pfile

--View pfile files that already exist Initprod.ora
[Email protected] ~]$ CD $ORACLE _home/dbs
[[email protected] dbs]$ ls
Init.ora Initprod.ora Orapwprod
[Email protected] dbs]$
--Validate Current environment variables
[Email protected] dbs]$ echo $ORACLE _sid
PROD
[Email protected] dbs]$
--Create SPFile with Pfile
[Email protected] dbs]$ Sqlplus/as SYSDBA

Sql*plus:release 11.2.0.4.0 Production on Fri Feb 28 16:34:35 2014

Copyright (c) 1982, Oracle. All rights reserved.

Connected to an idle instance.

Sql> create SPFile from Pfile;

File created.

Sql>!ls
Init.ora Initprod.ora Orapwprod Spfileprod.ora

Sql>

6: Database Boots to Nomount (by default, Oracle uses SPFile to start the database)

[Email protected] dbs]$ Sqlplus/as SYSDBA

Sql*plus:release 11.2.0.4.0 Production on Fri Feb 28 17:20:28 2014

Copyright (c) 1982, Oracle. All rights reserved.

Connected to an idle instance.

sql> startup Nomount;
ORACLE instance started.

Total System Global area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 671089544 bytes
Database buffers 390070272 bytes
Redo buffers 5517312 bytes
Sql>
Sql> Show Parameter SPFile

NAME TYPE VALUE
------------------------------------ ----------- ----------------------------------------------------------
SPFile String/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileprod.ora
Sql>
Sql> select status from V$instance;

STATUS
------------
STARTED

Sql>

7: Write CREATE DATABASE script
ORACLE11G Official documents:
Administrator ' s guide->2 Creating and configuring an Oracle database->step 9:issue the CREATE Database Statement
1) Modify database name and related password
2) because it is a test environment, you can change the log file to 1 members and change the member size to 10M
3) Modify the Users table space size and undo table space Size
4) Modify the name of the undo tablespace to be the same as the name in the Pfile file

CREATE DATABASE PROD
USER SYS identified by Oracle
USER SYSTEM identified by Oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/prod/redo01a.log ') SIZE 10M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/prod/redo02a.log ') SIZE 10M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/prod/redo03a.log ') SIZE 10M BLOCKSIZE 512
Maxlogfiles 5
Maxlogmembers 5
Maxloghistory 1
Maxdatafiles 100
CHARACTER SET Us7ascii
National CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DataFile '/u01/app/oracle/oradata/prod/system01.dbf ' SIZE 325M reuse
Sysaux datafile '/u01/app/oracle/oradata/prod/sysaux01.dbf ' SIZE 325M reuse
DEFAULT tablespace Users
DataFile '/u01/app/oracle/oradata/prod/users01.dbf '
SIZE 50M Reuse autoextend on MAXSIZE UNLIMITED
DEFAULT Temporary tablespace tempts1
Tempfile '/u01/app/oracle/oradata/prod/temp01.dbf '
SIZE 20M Reuse
UNDO tablespace UNDOTBS1
DataFile '/u01/app/oracle/oradata/prod/undotbs01.dbf '
SIZE 50M Reuse autoextend on MAXSIZE UNLIMITED;

8: Create the database (the database should now be in the Nomount state, execute the database script directly under Sqlplus)

sql> CREATE DATABASE PROD
2 USER SYS identified by Oracle
3 USER SYSTEM identified by Oracle
4 LOGFILE GROUP 1 ('/u01/app/oracle/oradata/prod/redo01a.log ') SIZE 10M BLOCKSIZE 512,
5 GROUP 2 ('/u01/app/oracle/oradata/prod/redo02a.log ') SIZE 10M BLOCKSIZE 512,
6 GROUP 3 ('/u01/app/oracle/oradata/prod/redo03a.log ') SIZE 10M BLOCKSIZE 512
7 Maxlogfiles 5
8 Maxlogmembers 5
9 Maxloghistory 1
Ten Maxdatafiles 100
CHARACTER SET Us7ascii
National CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DataFile '/u01/app/oracle/oradata/prod/system01.dbf ' SIZE 325M reuse
Sysaux datafile '/u01/app/oracle/oradata/prod/sysaux01.dbf ' SIZE 325M reuse
DEFAULT tablespace Users
DataFile '/u01/app/oracle/oradata/prod/users01.dbf '
SIZE 50M Reuse autoextend on MAXSIZE UNLIMITED
DEFAULT Temporary tablespace tempts1
Tempfile '/u01/app/oracle/oradata/prod/temp01.dbf '
SIZE 20M Reuse
UNDO tablespace UNDOTBS1
DataFile '/u01/app/oracle/oradata/prod/undotbs01.dbf '
SIZE 50M Reuse autoextend on MAXSIZE UNLIMITED;

Database created.

Sql> select status from V$instance;

STATUS
------------
OPEN

Sql>
--View related parameters
Sql> Show Parameter Control_files

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Control_files string/u01/app/oracle/oradata/prod/o
Ra_control1.ctl,/u01/app/orac
Le/oradata/prod/ora_control2.c
Tl
Sql> Show Parameter Undo

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Undo_management string AUTO
Undo_retention Integer 900
Undo_tablespace string UNDOTBS1
Sql> Show Parameter SPFile

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
SPFile string/u01/app/oracle/product/11.2.0
/dbhome_1/dbs/spfileprod.ora
Sql>

9: Create dictionary tables and toolkits

--Must execute script
Sql> Conn/as SYSDBA
Sql> @?/rdbms/admin/catalog.sql
Sql> @?/rdbms/admin/catproc.sql
Sql> Conn System/oracle
Sql> @?/sqlplus/admin/pupbld.sql
--Optional script
Sql> Conn/as SYSDBA
Sql> @?/rdbms/admin/catblock.sql
Sql> @?/rdbms/admin/catoctk.sql
Sql> @?/rdbms/admin/owminst.plb

Database manually built Library

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.