AI智能
改变未来

Oracle常用运维命令


1.oracle用户下

lsnrctl start 启动监听
lsnrctl status 查看监听状态
lsnrctl stop 关闭监听

2.关闭/启动数据库

连接sqlplus sqlplus / as sysdba
shutdown immediate 关闭数据库
startup 启动数据库

3.创建用户

1.创建临时表空间
查出当前数据库临时表空间

select name from v$tempfile;
create temporary tablespace NJ_OPERATION_TEMP tempfile \'/oradata/ckdb/NJ_OPERATION_TEMP.DBF\' size 50m autoextend on next 50m maxsize 10240m extent management local;

2.创建表空间
查询出当前数据库表空间

select name from v$datafile;
create tablespace NJ_OPERATION_DATA datafile \'/oradata/ckdb/NJ_OPERATION_DATA.dbf\' size 100m autoextend on next 50m maxsize 10240m extent management local;

3.创建用户,并指定表空间

create user NJ_OPERATION_USER identified by NJ_OPERATION_USER account unlock default tablespace NJ_OPERATION_DATA TEMPORARY TABLESPACE NJ_OPERATION_TEMP;

4.赋予用户权限

grant dba to NJ_OPERATION_USER;

4.导入dmp

1.查看虚拟目录

select * from dba_directories;

2.创建目录

create directory ora_back as \'/oradata/ckdb/dmp\';

3.手动创建/oradata/ckdb/dmp目录
4.把dmp文件传入到改文件夹下
5.开始导入

impdp NJ_OPERATION_USER/NJ_OPERATION_USER dumpfile=NJ_OPERATION_DEV_USER.dmp directory=ora_back remap_tablespace=NJ_OPERATION_DEV_DATA:NJ_OPERATION_DATA remap_schema=NJ_OPERATION_DEV_USER:NJ_OPERATION_USER schemas=NJ_OPERATION_DEV_USER table_exists_action=replace transform=segment_attributes:n;

把NJ_OPERATION_DEV_USER导入到NJ_OPERATION_USER

赞(0) 打赏
未经允许不得转载:爱站程序员基地 » Oracle常用运维命令