Oracle 11.2.0.4静默安装软件和创建数据库(2)

#此处只写必要的几个参数,生产上要按照实际情况写参数
[oracle@rhel6 ~]$ cat mydb.ora
db_name=mydb
control_files=/u01/app/oracle/oradata/mydb/control01.ctl,/u01/app/oracle/oradata/mydb/control02.ctl

4.3 启动实例到NOMOUNT状态

[oracle@rhel6 ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 21 17:26:31 2016
 
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
 
Connected to an idle instance.
 
SQL> startup nomount pfile=/home/oracle/mydb.ora;
ORACLE instance started.
 
Total System Global Area  217157632 bytes
Fixed Size        2251816 bytes
Variable Size        159384536 bytes
Database Buffers      50331648 bytes
Redo Buffers          5189632 bytes

4.4 创建spfile并重启到NOMOUNT状态

SQL> create spfile from pfile='/home/oracle/mydb.ora';
 
File created.
 
SQL> shutdown immediate;
ORA-01507: database not mounted
 
 
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
 
Total System Global Area  217157632 bytes
Fixed Size        2251816 bytes
Variable Size        159384536 bytes
Database Buffers      50331648 bytes
Redo Buffers          5189632 bytes

4.4 执行CREATE DATABASE语句创建数据库

SQL> CREATE DATABASE mydb
  2    USER SYS IDENTIFIED BY oracle
  3    USER SYSTEM IDENTIFIED BY oracle
  4    LOGFILE GROUP 1 ('/u01/app/oracle/oradata/redo01.log') SIZE 100M BLOCKSIZE 512,
  5            GROUP 2 ('/u01/app/oracle/oradata/redo02.log') SIZE 100M BLOCKSIZE 512,
  6            GROUP 3 ('/u01/app/oracle/oradata/redo03.log') SIZE 100M BLOCKSIZE 512
  7    MAXLOGFILES 5
  8    MAXLOGMEMBERS 5
  9    MAXLOGHISTORY 1
 10    MAXDATAFILES 100
 11    CHARACTER SET ZHS16GBK
 12    NATIONAL CHARACTER SET AL16UTF16
 13    EXTENT MANAGEMENT LOCAL
 14    DATAFILE '/u01/app/oracle/oradata/mydb/system01.dbf' SIZE 325M REUSE
 15    SYSAUX DATAFILE '/u01/app/oracle/oradata/mydb/sysaux01.dbf' SIZE 325M REUSE
 16    DEFAULT TABLESPACE users
 17        DATAFILE '/u01/app/oracle/oradata/mydb/users01.dbf'
 18        SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
 19    DEFAULT TEMPORARY TABLESPACE tempts1
 20        TEMPFILE '/u01/app/oracle/oradata/mydb/temp01.dbf'
 21        SIZE 20M REUSE
 22    UNDO TABLESPACE undotbs
 23        DATAFILE '/u01/app/oracle/oradata/mydb/undotbs01.dbf'
 24        SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
 
Database created.

4.5 执行创建数据字典脚本

conn / as sysdba
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
conn system/oracle
@?/sqlplus/admin/pupbld.sql

5、创建监听并启动

[oracle@rhel6 mydb]$ cd $ORACLE_HOME/network/admin
[oracle@rhel6 admin]$ ls
samples  shrept.lst
[oracle@rhel6 admin]$ vi listener.ora
[oracle@rhel6 admin]$ cat listener.ora
LISTENER=
  (DESCRIPTION=
    (ADDRESS_LIST=
      (ADDRESS=(PROTOCOL=tcp)(HOST=rhel6)(PORT=1521))
      (ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
[oracle@rhel6 admin]$ lsnrctl start
 
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 21-DEC-2016 17:41:13
 
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
 
Starting /u01/app/oracle/product/11.2.0/db/bin/tnslsnr: please wait...
 
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel6)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel6)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                    LISTENER
Version                  TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                21-DEC-2016 17:41:15
Uptime                    0 days 0 hr. 0 min. 2 sec
Trace Level              off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File  /u01/app/oracle/product/11.2.0/db/network/admin/listener.ora
Listener Log File        /u01/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel6)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
The listener supports no services
The command completed successfully

6、测试

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/849caf830a920173111ec57e79f268c0.html