表空间创建表空间SQL> create tablespace emp 2 logging 3 datafile '/Oracle/oradata/dba/emp.dbf' size 5M extent 4 management local;增加表空间大小SQL> alter tablespace emp 2 add datafile '/oracle/oradata/dba/emp_1.dbf' size 3M;删除表空间SQL> drop tablespace emp including contents;2 创建用户create user jackylau identified by richie default tablespace emp temporarytablespace temp quota 15m on emp passWord eXPire;授权用户grant dba to jackylau with admin option;alter user jackylau default role all;修改用户密码alter user jackylau identified by richie表创建表SQL> create table QQ 2 (name varchar(20), 3 id number(10), 4 relation varchar(6), 5 gender varchar(4)6 );从其它表中建表create table temp as select name,id from qq;重新命名一个表名rename qq to qqtest查看一个表的结构desc table_name;插入记录insert into qq (name,id,relation,gender) values ('宝儿','33796776','朋友','女');insert into qq values ('宝儿','33796776','朋友','女');修改记录 update qq set name='apple' where id = '371692320';把id号为371692320的项为name所在的名改为apple更改列的字符大小alter table qq modify (gender varchar(6));增加列alter table qq add time date;删除列alter table qq set unused ("TIME") cascade constraints;(注重TIME要大写)删除内容truncate table qq drop storage;(截掉,不可恢复)查询select * from qq;select id from qq where id='18243386';select * from qq where gender='女' order by name;select * from qq where id like '%8%' order by name;删除记录SQL> delete from qq 2 where id='18243386';回滚消除上一个COMMIT命令后的所做的全部修改,使得数据库的内容恢复到上一个COMMIT执行后的状态.使用方法是: SQL>rollback; LINK那个字段 LIKE "字符组合"字符组合 可以是固定字符 与 % 和 _ 的随意组合,其中 % 代表任意长度的任意字符,_ 代表单个字符where name like 'jacky___' 能查到 jackylau 却不能查到 jackylau+where name like '%acky___' 能查到 jackylau, abcackylau 却不能查到 jackylausomewordSQL> edit s<回车>
假如当前目录下不存在s.sql文件,则系统自动生成s.sql文件,
在其中输入“select * from tab;”,存盘退出。
SQL> @s<回车>
创建用户并授权SQL> create user 用户1 identified by 密码;
SQL> grant connect,resource to 用户1;
SQL> connect 用户1/密码
SQL> create table 表1(列1 number,列2 date);
SQL> create index 索引1 on 表1(列1);
SQL> drop index 索引1;
SQL> drop table 表1;创建视图Create or replace view testview as select col1,col2,col3 from table_name;create view test_view as select name,id,gender from qq;select * from test_view;create view qqtest as select name,id,relation lation from qq where id>100000000;(并重新命名relation列为lation)create view qqtest as select name,id,gender from qq where id>100000000 with read only;创建序列CREATE SEQUENCE inc_hourdiscount INCREMENT BY 1 START WITH 1 MAXVALUE 1.0E28;查看数据库show parameter db_name;select name from v$database;如何单独备份一个或多个用户?exp system/manager owner=(用户1,用户2,…,用户n) file=导出文件如何单独备份一个或多个表?exp 用户/密码 tables=(表1,
…,表2)