oracle 常用命令操作

创建表空间:

- drop tablespace user_temp  including contents and datafiles; 
- drop tablespace user_data  including contents and datafiles; 
- drop tablespace user_index including contents and datafiles;
- drop user C##AMAP cascade;
- drop user amap cascade;



- create temporary tablespace user_temp  tempfile   
  '/u01/app/oracle/oradata/orcl/amap/amap_temp.dbf' size 2G reuse      
  autoextend on next 20m maxsize unlimited;

- create tablespace user_data  datafile   
  '/u01/app/oracle/oradata/orcl/amap/amap.dbf' size 100M reuse         
  autoextend on next 40M maxsize unlimited;

- create tablespace user_index logging datafile   
  '/u01/app/oracle/oradata/orcl/amap/amap_index.dbf' size 100m         
  autoextend on next 32m maxsize 2048m extent management local;

创建common用户:

create user c##amap identified by amap default tablespace user_data temporary tablespace user_temp ;

创建local用户:

create user amap identified by amap default tablespace user_data temporary tablespace user_temp; 

用户授权:

- grant dba to amap;
- grant connect  to amap;
- grant resource   to amap;
- grant unlimited tablespace to amap;

导入命令

imp amap/amap@amap file=/opt/oracle/0430.dmp full=y

查看当前实例:

select status,instance_name from v$instance;

oracle 多个实例互相切换实例

windows中设置环境变量

set ORACLE_SID=a   

linux中设置环境变量

export ORACLE_SID=a  

//启动sqlplus

sqlplus / as sysdba

1.登录服务器,切换到oracle用户,或者以oracle用户登录

[admin@dataserver ~]$ su - oracle

密码:

[oracle@dataserver ~]$

2.打开监听服务

[oracle@localhost ~]$ lsnrctl start

可以通过lsnrctl status命令查看Oracle监听器运行状况

[oracle@localhost ~]$ lsnrctl status

3.以SYS用户身份登录Oracle

复制代码

[oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 1 23:29:19 2017

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> conn /as sysdba

Connected to an idle instance.

切换用户:

CONN 用户名/密码 [AS SYSDBA],如果是sys用户一定要写上AS SYSDBA

4.通过startup命令启动实例

SQL> startup

ORACLE instance started.

Total System … … Database mounted. Database opened.

二、Linux下关闭Oracle

1.关闭数据库实例

SQL> shutdown

Database closed. Database dismounted. ORACLE instance shut down.

SQL> quit

Disconnected from Oracle Database 11g Enterprise Edition Release
11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

2.关闭监听器

[oracle@localhost ~]$ lsnrctl stop
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ERD Online

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值