Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 402655344 bytes
Database Buffers 1191182336 bytes
Redo Buffers 7360512 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.
SQL> execute utl_recomp.recomp_serial();
PL/SQL procedure successfully completed.
SQL> alter system archive log current;
System altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
14 修改oracle启动配置文件
$vim /etc/oratab
hello:/opt/oracle/11.2.0:Y
这样就可以通过dbstart 启动此实例,也可以通过dbshut关闭此实例了。
$ dbshut /opt/oracle/11.2.0/
Processing Database instance "hello": log file /opt/oracle/11.2.0/shutdown.log
此时所有oracle的进程关闭,监听器也停止。
$dbstart /opt/oracle/11.2.0/
Processing Database instance "hello": log file /opt/oracle/11.2.0/startup.log
此时监听器工作,hello实例运行,再次查看监听器状态。
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-MAR-2012 07:35:52
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 14-MAR-2012 07:35:38
Uptime 0 days 0 hr. 0 min. 13 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/11.2.0/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/oracle11gcentos6/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "hello.dlxg.gov.cn" has 1 instance(s).
Instance "hello", status READY, has 1 handler(s) for this service...
Service "helloXDB.dlxg.gov.cn" has 1 instance(s).
Instance "hello", status READY, has 1 handler(s) for this service...
The command completed successfully
15 建立表空间及用户
$export ORACLE_SID=hello; sqlplus / as sysdba
进入SQL>后
创建临时表空间
create temporary tablespace user_temp tempfile '/opt/oracle/oradata/hello/user_temp.dbf' size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
创建数据表空间
create tablespace user_data
logging
datafile '/opt/oracle/oradata/hello/user_data.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
创建用户并指定表空间
create user test identified by test
default tablespace user_data
temporary tablespace user_temp;
给用户授予权限
grant connect,resource to test;
此时在其他机器上可以远程登录这个用户,命令为:
$sqlplus test/test@172.16.2.182/hello.dlxg.gov.cn
16 用新建的用户连接数据库,并建立一个表
$ export NLS_LANG=American_America.AL32UTF8
注意:UTF8是为了使得sqlplus和linux终端环境一致起来,此时发往数据库的是UTF8,数据库存储前会转为ZHS16GBK.
当读取时,Sqlplus会把收到的ZHS16GBK转换为UTF8发送到Linux终端。
$ sqlplus test/test@172.16.2.182/h