您的位置:首页 > 数据库

sql/pl基本操作】【登陆】【格式化table显示】【两个数据库表复制数据】【格式化输出】

2013-11-04 00:55 597 查看
sqlplus /nolog
sqlplus hugh1216/hugh@hughdb as sysdba
exit
quit
select to_char(SYSDATE) FROM DUAL;
select to_char(sysdate,'HH12:MI:SS') from dual;
disc  --断开连接
disconnect
表空间
select * from dba_tablespaces
select * from dba_tables where TABLESPACE_NAME='UNDOTBS1'
SELECT * FROM DBA_TABLES WHERE OWNER='HUGH'
SELECT * FROM HUGH.ACADEMY
select * from dba_users
select * from user_ts_quotas

sqlplus 命令
tttile left 'xxxxxxxx'
col academy_id heading 'id' justify left format '9999'
col academy_name heading 'academy' format 'A10' justify center
select * from hugh.academy;

clear col
clear sql
clear screen
两个数据库表复制数据
copy from scott/hugh@orcl to hugh/hugh@hughdb replace dept using select * from scott.dept;
select * from dba_tables where TABLE_NAME='DEPT'

copy from hugh/hugh@hughdb create academy(academy_id,academy_name)  using select deptno,dname  from hugh.dept           ---------覆盖的方式COPY~
copy from hugh/hugh@hughdb insert academy(academy_id,academy_name)  using select deptno,dname  from hugh.dept           ---------追加的方式COPY~
define

define deptno="10"
select * from hugh.dept where deptno=&deptno;

desc academy --------查询表结构

variable n number;
execute :n :=1;
host
host dir
set autocommit on
set autotrace on
set pagesize 24

show all
show sga
show spool
show errors

select academy_id||','||academy_name||',' from academy
select * from global_name;
show parameter global_name;

select * from v$option;
col value justify left format 'a25'
col parameter justify left format 'a50'
set linesize 76   ------a25+a50+1=76,当linesize<76,不能在sqplus中一行显示
备注
linesize 规定sqlplus窗口中一行的长度一定是linesize大小,也就是说当
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: