前提条件:oracle 软件已经安装好了。
第一步:unix环境变量
$ env|grep ORACLE
ORACLE_SID=demoa
ORACLE_BASE=/u01
ORACLE_HOME=/u01/db
第二步:建目录
$ pwd
/u01
[oracle@10G_1 u01]$ ll admin
total 24
drwxr-xr-x 2 oracle oinstall 4096 Sep 30 08:44 adump
drwxr-xr-x 2 oracle oinstall 4096 Sep 30 08:44 bdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 30 08:44 cdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 30 08:44 dpdump
drwxr-xr-x 2 oracle oinstall 4096 Sep 30 08:44 pfile
drwxr-xr-x 2 oracle oinstall 4096 Sep 30 08:44 udump
$mkdir -p oradata/demoa
第三步:建pfile
$ cat initdemoa.ora
db_name=demoa
sga_target=512M
undo_management=auto
control_files = (ora_control1, ora_control2)
第四步:运行建库脚本
$ sqlplus /nolog
SQL> startup nomount;
ORA-01031: insufficient privileges
SQL> connect sys/change_on_install as sysdba;
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 536870912 bytes
Fixed Size 1220432 bytes
Variable Size 150995120 bytes
Database Buffers 381681664 bytes
Redo Buffers 2973696 bytes
SQL> create spfile from pfile;
File created.
SQL>CREATE DATABASE demoa
USER SYS IDENTIFIED BY sys
USER SYSTEM IDENTIFIED BY sys
LOGFILE GROUP 1 ('/u01/oradata/demoa/redo01.log') SIZE 100M,
GROUP 2 ('/u01/oradata/demoa/redo02.log') SIZE 100M,
GROUP 3 ('/u01/oradata/demoa/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/u01/oradata/demoa/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/oradata/demoa/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE tbs_1 DATAFILE '/u01/oradata/demoa/tbs_1.dbf' SIZE 10m REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/oradata/demoa/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u01/oradata/demoa/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
第五步:建view,synonyms. PL/SQL package:
09:17:53 SQL> @/u01/db/rdbms/admin/catalog.sql
09:21:37 SQL> @/u01/db/rdbms/admin/catproc.sql
PL/SQL procedure successfully completed.
09:33:19 SQL>
建监听器
$ cat listener.ora
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=8888))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
$
10:07:46 SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=8888))';
System altered.
10:07:58 SQL> alter system register;
System altered.
注意不是默认的1521端口,需要设置local_listener参数,不然不能自动注册。
创建口令文件:
$ orapwd file=orapwdemoa password=sys entries=20 force=y;
远程连接
C:\>sqlplus sys/sys@192.168.23.2:8888/demoa as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 9月 30 10:24:53 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
建立EM
]$ emca -config dbcontrol db -repos create
STARTED EMCA at Sep 30, 2008 10:29:09 AM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: demoa
Listener port number: 8888
Password for SYS user:
Password for DBSNMP user:
Password for SYSMAN user:
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------
You have specified the following settings
Database ORACLE_HOME ................ /u01/db
Database hostname ................ 10G_1
Listener port number ................ 8888
Database SID ................ demoa
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............
-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Sep 30, 2008 10:29:32 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/db/cfgtoollogs/emca/demoa/emca_2008-09-30_10-29-09-AM.log.
Sep 30, 2008 10:29:36 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Sep 30, 2008 10:33:08 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Sep 30, 2008 10:33:14 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 30, 2008 10:35:11 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Sep 30, 2008 10:35:12 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is http://10G_1:5500/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 30, 2008 10:35:12 AM
打开下面的网页----成功
http://192.168.23.2:5500/em/
将浏览器的语言设置成英文在中文上面,不然图标里的中文时乱码,现在谁用中文呀!
IE设置方法:工具-》Internet选项-》常规-》语言
FireFox设置方法:工具-》选项-》内容-》语言