oracle操作简单的命令

create tablespace hello //创建表空间
datafile 'd:/1.dbf'
size 5M
extent management local autoallocate //本地管理表空间
segment space management auto;//自动管理段


//创建用户
create user root identified by "root"//登陆
default tablespace yd temporary tablespace temp;

//授权用户
grant connect to root,
grant resource to root,
grant unlimited tablespace;

drop tablespace 表空间名

-----
监听,一个实例
监听启动 isnrctl start
启动实例
oradim -startup -sid orcl

创建用户
create user yoscar identified by yoscar

创建session 会话权限
grant create session to yoscar

分配创建表的权限

grant create table to yoscar

创建表空间

grant unlimited tablespace

撤销权限

revoke create table from yoscar
查看当前用户具有的哪些权限
select * from user_sys_privs;

修改密码,
alter user scott identified by tiger
--Linux下启动oracle

isnrctl start 启动监听 接受用户请求
sqlplus / as sysdba //连接进去,不登陆
conn sys/oracle as sysdba //用sys用户连接
startup
--windows下oracle启动过程
lsnrctl start//先启动监听,然后启动实例
oradim -startup -sid orcl

sys密码丢了修改,oracle/products/10.2.0/db_2/database PWDorcl.ora

orapwd file=d:oracle/products/10.2.0/db_2/database/PWDorcl.ora passwd=123456 entries=10;

查看用户
select * from v$pwfile_users;

让所有的拥有创建的权限
-----
create tablespace welcome
datafile 'd:/welcome.dbf'
size 5M
extent management local autoallocate
segment space management auto;

create user root identified by "root"
default tablespace welcome temporary tablespace temp;

//授权用户
grant connect to root
grant resource to root
grant unlimited tablespace to root

//先把表空间设置成只读
alter tablespace welcome read only ;

exp 'root/root as sysdba' TRANSPORT_TABLESPACE=Y TABLESPACES=(WELCOME) FILE=C:\welcome.dmp;
修改表空间的读写属性
alter tablespace testspace read write;

删除表空间
alter tablespace welcome offline
drop tablespace welcome including contents

删除用户
drop user *** cascade;
给root赋予dba的角色权限
grant dba to root

用imp命令导入数据表时出现了
经由常规路径由 EXPORT:V10.02.01 创建的导出文件
IMP-00013: 只有 DBA 才能导入由其他 DBA 导出的文件 IMP-00000: 未成功终止导入
的错误,在网上找了一些解决方案,现找到一种解决方案,分享如下:
imp时连接用户没有DBA权限或者default role不是DBA
你可以换个有DBA role的用户IMP。
如果你还想用这个用户,如果这个用户没有DBA权限就grant dba to 用户;
如果default role不是DBA,那就 alter user 用户 default role DBA;

如:grant dba to scott

导出几个表命令
exp root/root@orcl file=f:\0720.dmp tables(xs_jxfcm,xx_dmjlb,xx_dmjxx)


导出表空间命令
exp root/root@orcl file=f:\0720.dmp
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值