(2)启动TNS监听器
$ORACLE_HOME/bin/lsnrctl start (要带$)
(3)用sqlplus启动数据库
$ORACLE_HOME/bin/sqlplus /nolog
SQL> connect system/change_on_install as sysdba
SQL> startup
出现如下显示,表示Oracle已经成功启动;
ORACLE instance started
Total System Global Area 205520896 bytes
Fixed Size 778392 bytes
Variable Size 74456936 bytes
Database Buffers 130023424 bytes
Redo Buffers 262144 bytes
Database mounted.
Database opened.
(4)用sqlplus停止数据库
$ORACLE_HOME/bin/sqlplus /nolog
SQL> connect system/change_on_install as sysdba
SQL> shutdown
出现如下显示,表示oracle已经停止
Database closed.
Database dismounted.
ORACLE instance shut down.
注:shutdown可加关闭选项,从最温和到最粗暴的行为选项为(shutdown、shutdown transactional、shutdown immediate、shutdown abort)
shutdown:关闭,等待每个用户退出系统戓被取消后退出关闭数据库;
shutdown transactional:事务性关闭,等待每个用户提交戓回退当前的事务,然后oracle取消对话,在所有用户退出系统后执行关闭;
shutdown immediate:直接关闭,取消所有用户对话(促使回退),执行正常的关闭程序;
shutdown abort:终止关闭,关闭数据库时没有自动检查点戓日志开关。
8.关闭linux防火墙:
(1)临时关闭:sudo /sbin/rcSUSEfirewall2 stop
(2)永久关闭:
chkconfig --list|grep fire
chkconfig --level 5 SuSEfirewall2_final off
chkconfig --level 5 SuSEfirewall2_setup off
chkconfig --level 5 SuSEfirewall2_init off
9.开启isqlplus:
$ORACLE_HOME/bin/isqlplusctl start
$ORACLE_HOME/bin/isqlplusctl stop
iSQL*Plus URL:
http://localhost:5560/isqlplus
iSQL*Plus DBA URL:
http://localhost:5560/isqlplus/dba
10.开启dbconsole:
$ORACLE_HOME/bin/emctl start dbconsole
$ORACLE_HOME/bin/emctl stop dbconsole
Enterprise Manager 10g Database Control URL:
http://localhost:1158/em
11.导入数据:
oracle@localhost:~/Desktop> imp
Import file: expdat.dmp > feq.dmp //输入要导入的数据文件
Enter insert buffer size (minimum is 8192) 30720> 10000 //输入缓冲区大小,可以默认也可以自定义,如果数据文件较大,建议设置的大一些
List contents of import file only (yes/no): no > no //只列出导入文件的内容
Ignore create error due to object existence (yes/no): no > yes //由于对象已存在, 忽略创建错误
Import grants (yes/no): yes > yes //导入权限
Import table data (yes/no): yes > yes //导入表数据,如果选NO,则导入表结构
Import entire export file (yes/no): no > yes //导入整个导出文件
12.附加sql语句:
connect as sysdba
connect
create user aaa identified by bbb; (创建一个用户名为aaa,密码为bbb的用户)
grant dba to aaa; (将dba的权限分配给用户aaa)
卸载:
oracle11g自带一个卸载批处理app\Administrator\product\11.2.0\dbhome_1\deinstall\deinstall.bat
运行该处理文件自动完成卸载oracle卸载工作,最后手动删除\app文件夹
在运行的过程中可能需要填写如下项:
指定要取消配置的所有单实例监听程序[LISTENER]: LISTENER
指定在此oracle主目录中配置的数据库名的列表[MYDATA,ORCL]:MYDATA,ORACL
是否仍要修改MYDATA,ORACL数据库的详细资料?[n]:n
CCR check is finished
是否继续[y-是,n-否]?[n]:y
linuxidc@www.linuxidc.com:~ # userdel oracle
userdel: account `oracle' is currently in use.
注:如果该用户正在连接,是删不掉的,我们可以先kill 掉该用户。 在删。
# who
root console 3月 18日 10:06 (:0)
dave pts/2 3月 18日 10:19 (10.85.10.80)
root pts/4 3月 18日 10:07 (:0.0)
#ps -t pts/2
PID TTY TIME CMD
1118 pts/2 0:00 ps
1112 pts/2 0:00 bash
#kill -9 1118
#kill -9 1112
# who
root console 3月 18日 10:06 (:0)
root pts/4 3月 18日 10:07 (:0.0)
