一、Oracle用户、目录及session会话查看:
1.Sqlplus 中修改用户密码
命令框输入cmd
弹出框内输入 sqlplus /nolog connect /as sysdba
更改用户密码:alter user username identified by “newpassword”;
2.Sqlplus 中查看和修改连接数和会话数
修改和查看oracle最大连接数和session:
select value from v$parameter where name = ‘processes’;
show parameter sessions
查看当前连接数
select count(*) from v$process;
查看当前会话数:
select count(*) from v$session;
alter system set processes=800 scope=spfile;
alter system set sessions=885 scope=spfile;
一般设置为800比较合适,session为连接数的1.1*processes+5,设置之后必须重启oracle。
重启数据库:
shutdown immediate;
startup;
3.创建用户、表空间
–创建表空间
create tablespace test
logging
datafile ‘D:\DATA\user_data.dbf’
size 10240m
autoextend on
next 50m maxsize 20480m
extent management local;
–创建用户
create user admin identified by “123456”
default tablespace test;
–给用户赋权限
grant dba to admin ;
4.删除用户、表空间
–删除用户
drop user admin cascade;
–删除表空间
drop tablespace test including contents and datafiles;
5.监听状态查看
启动监听
lsnrctl start
停止监听
lsnrctl stop
查看监听状态
lsnrctl status
二、Oracle 数据导入、导出
1.impdp & expdp的用法:
impdp 用户名/密码@服务名 导入已经有的数据库
impdp system/123@orcl
expdp 用户名/密码@服务名 导出已经有的数据库,默认(app\Administrator\admin\orcl\dpdump)
expdp ysgl/abc123@ysgl version=’11.2.0.1.0’
2.imp & exp
exp test/crm3180@CRM tables=(sms_send_receive) file=G:\CRMDATA\SMS_SEND_RECEIVE20141018.DMP
LOG=G:\CRMDATA\SMS_SEND_RECEIVE20141018.LOG
IMP CRM/CRM@ORCL FILE=D:\CRMDATA\CRM_2014-11-26.DMP LOG=D:\CRMDATA\CRM_2014-11-26.LOG FROMUSER=TEST TOUSER=CRM
3.解锁语句
SELECT 'alter system kill session ''' || S.SID ||','||s.serial# ||''';' , s.username,
decode(l.type, 'TM', 'TABLE LOCK', 'TX', 'ROW LOCK', NULL) LOCK_LEVEL,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial#
FROM gv$session s, gv$lock l, dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT NULL
AND O.OWNER='test'--用户名