第0章:oracle_sql语句之基本操作
sql里面保存屏幕输出的内容的命令:
spool /tmp/a.txt
******执行任何sql操作
spool off
ho cat /tmp/a.txt
启动sqlplus工具:
su - oracle
$lsnrctl status/start/stop 查看监听状态以及启动停止监听
sqlplus / as sysdba
sqlplus工具启动成功,进入SQL提示符!
SQL>
进入SQL提示符要做的第一件事是登录:
SQL>conn scott/tiger
查看当前使用哪一个用户登录的
SQL> show user
在命令行为scott用户解锁:
SQL>conn / as sysdba
SQL>alter user scott identified by tiger account unlock;
SQL>conn scott/tiger
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
查看数据库相关的系统进程:
ps -ef | grep ora_
查看数据库的共享内存是否分配:
ipcs -sm
系统reboot后怎么启动数据库?
su - oracle
sqlplus / as sysdba
SQL>startup或者shutdown immediate
SQL>select status from v$instance; 查看实例状态,正常为open
SQL>conn scott/tiger