首页 > 数据库 > Oracle > Oracle建表,序列等操作
--导入导出数据库文件
sqlplus reporter/reporter@IMNMS
cd /opt/backup/oracle/data
exp reporter/reporter@IMNMS /opt/oracle/status.dmp full=y
imp reporter/reporter@IMNMS file=/opt/oracle/status.dmp
--修改用户的密码
select * from dba_users where username='TAOKAUSER';
alter user TAOKAUSER identified by sasa;
--授权
grant all on dcs.dcs_category to bafapps;--
grant all on dcs.dcs_category_tl to bafapps;
--创建同义词
create synonym dcs_category for dcs.dcs_category;
create synonym dcs_category_tl for dcs.dcs_category_tl;
--创建表空间
CREATE TABLESPACE TaoKa DATAFILE
LOGGING
ONLINE
PERMANENT
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT MANUAL;
--创建用户
CREATE USER TaoKaUser
// 创建一个序列
CREATE SEQUENCE Car_GUID increment by 1;
// 创建一个表
CREATE TABLE Car
(
);
// 添加注释
comment on table car is '定位信息用户表';
Comment on column car.guid is '自增字段';
Comment on column Car.PhoneId is '电话唯一标识';
Comment on column Car.UserName is '用户名称';
// 添加一条记录
INSERT INTO Car(GUID, PhoneId, UserName) Values(CAR_GUID.nextval,
'13589256783', '张三');
// 提交
commit;
// 触发器
create or replace trigger
Trigger_Car_GUID_Insert
before insert on Car
for each row
begin
end;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/750643/viewspace-1117606/ ,如需转载,请注明出处,否则将追究法律责任。