1.如何链接数据库
由操作系统验证方式:
SQL>conn / as sysdba
SQL>CONN username/password @databaseIdentified AS sysdba
SQL>start file_name SQL>@ file_name我们可以将多条sql语句保存在一个文本文件中,这样当要执行这个文件中的所有的sql语句时,用上面的任一命令即可,这类似于dos中的批处理。
SQL> run
SQL> SPOOL file_name
SQL> SPOOL OFF
SQL> desc table_name
COL columnname format a20
COLUMN column_name HEADING column_heading For example: Sql>select * from dept; DEPTNO DNAME LOC---------- ---------------------------- ---------
sql>col LOC heading location sql>select * from dept; DEPTNO DNAME location--------- ---------------------------- -----------
SQL> SET WRA[P] {ON|OFF}
C[HANGE] /old_value/new_value SQL> l 1* select * from dept SQL> c/dept/emp 1* select * from emp10.显示sql buffer中的sql语句,list n显示sql buffer中的第n行,并使第n行成为当前行
L[IST] [n]
I[NPUT]
A[PPEND] SQL> select deptno, 2 dname 3 from dept; DEPTNO DNAME---------- --------------
10 ACCOUNTING 20 RESEARCH 30 SALES 40 OPERATIONS SQL> L 2 2* dname SQL> a ,loc 2* dname,loc SQL> L 1 select deptno, 2 dname,loc 3* from dept SQL> / DEPTNO DNAME LOC ---------- -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON12.再次执行刚才已经执行的sql语句
RUN or /13.执行一个存储过程
EXECUTE procedure_name
HELP
Syntax SHO[W] option1) . 显示当前环境变量的值:
Show all
Show error
show PARAMETERS [parameter_name]
show REL[EASE]
show SGA
show user