环境:win10_X64_Pro
1.创建数据库实例,实例名为PF
实例已创建。
错误:dim-00014:无法打开 Windows NT 服务控制管理器。OS-Error:(OS 5) 拒绝访问。
处理办法:以管理身份运行。
2.为了sys用户可以连入数据库执行操作,先创建数据库的密码文件,密码文件的名称必须为PWDsid.ora
3.创建下列目录,以存放数据文件和dump信息
#数据文件目录
C:\oraclexe\app\oracle\oradata\PF
#background dump目录
C:\oraclexe\app\oracle\oradata\PF\bdump
#core dump目录
C:\oraclexe\app\oracle\oradata\PF\cdump
#user dump目录
C:\oraclexe\app\oracle\oradata\PF\udump
4.修改listener.ora为下列信息,把此数据库注册在监听器中(可选)在C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN下
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = wanglifu)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (PF)
根据文件添加
5.为了可以访问数据库,修改tnsnames.ora为下列信息
在C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN下
PF =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PF)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
6.建立pfile文件C:\oraclexe\app\oracle\product\11.2.0\server\database\initPF.ora,文件的内容如下:(注意文件名)
background_dump_dest='C:\oraclexe\app\oracle\oradata\PF\bdump'
compatible='11.2.0.1.0'
control_files='C:\oraclexe\app\oracle\oradata\PF\control01.ctl',C:\oraclexe\app\oracle\oradata\PF\control02.ctl'
core_dump_dest='C:\oraclexe\app\oracle\oradata\PF/cdump'
db_block_size=8192
db_name='PF'
db_recovery_file_dest='C:\oraclexe\app\oracle\fast_recovery_area'
db_recovery_file_dest_size=2147483648
pga_aggregate_target=41943040
processes=150
remote_login_passwordfile='EXCLUSIVE'
sga_max_size=167772160
sga_target=125829120
undo_management='AUTO'
undo_tablespace='undotbs1'
user_dump_dest='C:\oraclexe\app\oracle\oradata\PF/udump'
db_create_file_dest='C:\oraclexe\app\oracle\oradata\PF'
db_create_online_log_dest_1='C:\oraclexe\app\oracle\oradata\PF'
7.连入数据库,并创建spfile文件
C:\oraclexe\app\oracle\product\11.2.0\server\bin>set ORACLE_SID=PF
C:\oraclexe\app\oracle\product\11.2.0\server\bin>sqlplus.exe / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on 星期五 12月 18 11:17:05 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
已连接到空闲例程。
SQL>create spfile from pfile;
文件已创建。
8.启动数据库到nomount
SQL>startup nomount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORA-12853: insufficient memory for PX buffers: current 0K, max needed 0K
ORA-04031: unable to allocate 65560 bytes of shared memory ("large pool","unknown object","large pool","PX msg pool")
SQL>
9.创建并执行creata database文件C:\oraclexe\app\oracle\admin\PF\Create\createdb.sql脚本,具体内容如下:
create database PF
user sys identified by oracle
user system identified by oracle
default temporary tablespace temp
undo tablespace undotbs1
character set utf8
national character set al16utf16;
SQL>@C:\oraclexe\app\oracle\admin\PF\Create\createdb.sql
10.执行catalog.sql,创建数据库的数据字典视图
SQL>spool C:\oraclexe\catalog.log
SQL>@C:\oraclexe\app\oracle\product\11.2.0\server\RDBMS\ADMIN\catalog.sql
SQL>spool off
11.执行catproc.sql,创建执行PL/SQL程序所需的所有包
SQL>spool C:\oraclexe\catproc.log
SQL>@C:\oraclexe\app\oracle\product\11.2.0\server\RDBMS\ADMIN\catproc.sql
SQL>spool off
到此数据库PF创建完毕,可以正常使用了。
需要注意的地方:
(1)在11g中,如果system01.dbf这个文件用extent management local的话,必须创建一个temporary表空间。
(2)11g必须创建sysaux01.dbf这个文件
(3)如果以上步骤出现错误,而错误提示为乱码的话,可以退出SQLPLUS,然后设置环境变量set nls_lang=american_america.zhs16gbk(windows),然后再登录数据库。
总结:创建过程中出现了很多的问题和报错,出现报错后查看告警日志alert_pf,本例中路径是C:\oraclexe\app\oracle\oradata\PF\bdump,根据错误号可以google一下,能解决很多问题,具体出现的一些问题我会在日志中记录下来。