sqlplus sys/password@orcl as sysdba ----cmd 进入Oracle sqlplus
1、导入例子:
imp username/username@127.0.0.1:1521/orcl file=D:\datasource\username0919.dmp full=y
imp 用户名/密码@127.0.0.1:1521/orcl file=D:\datasource\备份名字.dmp full=y
2、导出例子:
exp c##username /username @orcl file=d:\20180320.dmp owner=c##username
exp 用户名/密码U@orcl file=备份路径.dmp owner=用户名
其他常用的几个Oracle命令:
1.删除用户
例子:drop user usernamecascade;
:drop user 用户名 cascade;
2.删除表空间
例子:DROP TABLESPACE usernameINCLUDING CONTENTS AND DATAFILES;
DROP TABLESPACE 表空间名字 INCLUDING CONTENTS AND DATAFILES;
3.创建表空间
例子:CREATE TABLESPACE username DATAFILE 'D:\datasource\username.DBF' SIZE 4096M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
CREATE TABLESPACE 表空间名 DATAFILE '表空间存放路径' SIZE 表空间大小值M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
4.创建用户
例子:CREATE USER PT_CHENZHOU IDENTIFIED BY username DEFAULT TABLESPACE username;
CREATE USER 用户名 IDENTIFIED BY 密码 DEFAULT TABLESPACE PT_CHENZHOU ;
5.授权
例子:GRANT CONNECT, RESOURCE, DBA TO username;
GRANT CONNECT, RESOURCE, DBA TO 用户名;
6.修改数据库连接数限制
查看:select value from v$parameter where name ='processes'; 语句查看,最大进程连接数为4000.
修改:alter system set processes = 3000 scope = spfile;修改连接数。(修改3000只是示范,大多时候是连接数不够,数值修改的更大)
修改processes和sessions值必须重启oracle服务器才能生效:
shutdown immediate;关闭实例
startup启动
可以用如下命令查看数据库连接的消耗情况:select b.MACHINE, b.PROGRAM, b.USERNAME, count(*) from vp r o c e s s a , v process a, vprocessa,vsession b where a.ADDR = b.PADDR and b.USERNAME is not null
group by b.MACHINE, b.PROGRAM, b.USERNAME order by count(*) desc