orace后台执行

7.19    数据库后台执行命令和客户端登陆
sqlplus username/password@host:port/sid --普通用户
sqlplus / as sysdba或者conn / as sysdba --sys用户
PL/SQL普通用户登陆:DataBase:10.171.37.11:1526/testdb;Connect as :Normal
PL/SQLsys用户登陆: DataBase:10.171.37.11:1526/testdb;Connect as :SYSDBA
7.20    查看数据库家目录基础目录及实例名
使用oracle用户执行echo $ORACLE_HOME命令可查询Oracle Home目录。
使用oracle用户执行echo $ORACLE_BASE命令可查询Oracle基础目录。
Oracle数据库实例名,当数据库实例已经存在时,可使用echo $ORACLE_SID查询已有数据库实例名。(客服端:select name from v$database;)
env|grep ora

7.21    查看数据库用户名和数据表
select username from dba_users;--查看数据库用户
select * from user_tables;--查看数据中表
select *from session_roles;
select name from v$database;--数据库名
select instance_name from v$instance;--查看实例名
7.22    导出和导入数据库文件
exp log=TESTdbexport.log file=TEST_db_backup20150924.dmp userid=TESTdb/TESTdb grants=yes rows=yes constraints=yes indexes=yes buffer=100000
exp log=TESTUSERexport.log file=TESTUSER_db_backup20150924.dmp userid=TESTUSER/TESTUSER grants=yes rows=yes constraints=yes indexes=yes buffer=100000
imp file=TEST_db_backup20150924.dmp userid=TESTdb/TESTdb_db1 fromuser=TESTdb touser=TESTdb grants=yes ignore=yes rows=yes show=no constraints=yes indexes=yes buffer=100000;  
imp file=TESTUSER_db_backup20150924.dmp userid=TESTUSER/TESTUSER_db11 fromuser=TESTUSER touser=TESTUSER grants=yes ignore=yes rows=yes show=no constraints=yes indexes=yes buffer=100000;
7.23    后台执行sql脚本
Sqlplus u/p
@DB.User.XN1338814717746.20150817172854.sql

7.24    ORA-01950对表空间 无权限
用户没有对表空间操作的权限
创建用户时语句没有执行
grant unlimited tablespace to testuser;
执行:
grant resource to testuser;
执行了resource之后,权限就会变成
-- Create the user
create user TEST
  default tablespace USERS
  temporary tablespace TEMP
  password expire;
-- Grant/Revoke role privileges
grant connect to TEST;
grant resource to TEST;
-- Grant/Revoke system privileges
grant unlimited tablespace to TEST;

SYS用户下可以查看resrouce包括的权限
select grantee,privilege from dba_sys_privs
         where grantee='RESOURCE' order by privilege;



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值