1.指定oracle_sid
$ export ORACLE_SID=db12
2.指定环境变量
比如ORACLE_BASE、ORACLE_HOME、PATH(要包含$ORACLE_HOME/bin)
3.选定验证方式
·操作系统验证
·口令文件验证
4.创建初始化参数文件
$ vi initdb12.ora db_name=‘db12‘ memory_target=2G processes = 150 db_block_size=8192 db_domain=‘‘ diagnostic_dest=‘/u12/app/oracle‘ dispatchers=‘(PROTOCOL=TCP) (SERVICE=db12XDB)‘ open_cursors=300 remote_login_passwordfile=‘EXCLUSIVE‘ undo_tablespace=‘undotbs1‘ control_files =‘/u12/app/oracle/oradata/db12/control01.ctl‘,‘/u12/app/oracle/oradata/db12/control02.ctl‘ compatible =‘12.0.0‘ audit_file_dest=‘/u12/app/oracle/admin/db12/adump‘ audit_trail=‘db‘ enable_pluggable_database=true
5.如果是windows,需要创建一个实例
> oradim -NEW -SID <sid> -STARTMODE MANUAL -PFILE <file>
6.连接到实例
$ sqlplus /nolog SQL> conn /as sysdba Connected to an idle instance.
7.创建spfile
SQL> create spfile from pfile; File created. SQL>
8.启动实例
SQL> startup nomount; ORACLE instance started. Total System Global Area 2147483648 bytes Fixed Size 2926472 bytes Variable Size 1291847800 bytes Database Buffers 838860800 bytes Redo Buffers 13848576 bytes SQL>
9.执行create database命令
create database db12 user sys identified by oracle user system identified by oracle logfile group 1 (‘/u12/app/oracle/oradata/db12/redo01a.log‘,‘/u12/app/oracle/oradata/db12/redo01b.log‘) size 100m, group 2 (‘/u12/app/oracle/oradata/db12/redo02a.log‘,‘/u12/app/oracle/oradata/db12/redo02b.log‘) size 100m, group 3 (‘/u12/app/oracle/oradata/db12/redo03a.log‘,‘/u12/app/oracle/oradata/db12/redo03b.log‘) size 100m maxloghistory 1 maxlogfiles 16 maxlogmembers 3 maxdatafiles 1024 character set al32utf8 national character set al16utf16 extent management local datafile ‘/u12/app/oracle/oradata/db12/system01.dbf‘ size 700m reuse autoextend on next 10240k maxsize unlimited sysaux datafile ‘/u12/app/oracle/oradata/db12/sysaux01.dbf‘ size 550m reuse autoextend on next 10240k maxsize unlimited default tablespace users datafile ‘/u12/app/oracle/oradata/db12/users01.dbf‘ size 500m reuse autoextend on maxsize unlimited default temporary tablespace tempts1 tempfile ‘/u12/app/oracle/oradata/db12/temp01.dbf‘ size 20m reuse autoextend on next 640k maxsize unlimited undo tablespace undotbs1 datafile ‘/u12/app/oracle/oradata/db12/undotbs01.dbf‘ size 200m reuse autoextend on next 5120k maxsize unlimited enable pluggable database seed file_name_convert = (‘/u12/app/oracle/oradata/db12‘, ‘/u12/app/oracle/oradata/db12/pdb1‘) system datafiles size 125m autoextend on next 10m maxsize unlimited sysaux datafiles size 100m user_data tablespace usertbs datafile ‘/u12/app/oracle/oradata/db12/pdb1/usertbs01.dbf‘ size 200m reuse autoextend on maxsize unlimited;
10.运行脚本创建数据字典视图
以sysdba执行 @?/rdbms/admin/catalog.sql @?/rdbms/admin/catproc.sql 在system用户下执行 @?/sqlplus/admin/pupbld.sql
11.windows的话设置开机自动启动
> ORADIM -EDIT -SID <sid> -STARTMODE AUTO -SRVCSTART SYSTEM [-SPFILE]
12.查看
SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 3463549582 PDB$SEED READ ONLY SQL> select con_id,dbid,name,open_mode from v$containers; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 1 1741224387 CDB$ROOT READ WRITE 2 3463549582 PDB$SEED READ ONLY SQL>
时间: 2024-10-27 18:17:16