标签:
1.
查看数据库的归档模式及闪回是否启用
select
log_mode,open_mode,flashback_on from V$database;
2.查看实例状态
select status from
V$instance;
3.卸载数据库实例
shutdown immediate;
4.启动数据库实例
startup mount;
5.更改数据库读写状态
alter
database activate standby database;
6.查询数据库版本
select
* from V$version;
7.查询实例名
select
instance_name from V$instance;
8.连接数据库
conn username/password@databasename
(as sysdba)
9.查询所有表名
select distinct table_name from
user_tab_columns; //系统内置表
10.创建表空间
create tablespace news_tablespace datafile ‘F:\...‘ size 500M;
11.给表空间授权
grant username to
tablespace;
12.创建表
create table
student(sid number,sname varchar2(30));
13.设置自动提交
set autocommit on;
14.开启自动归档
quit;sqlplus/nolog;select status
from V$instance;
shutdown immediate; //关闭实例
startup mount;
archive log
list;
alter database archivelog;
archive log list;alter system set log_archive_dest_1=‘location=E:\oracle\product‘;
alter system set log_archive_dest_1=‘location=/home/logdata‘;
[Linux下设置归档路径]
15.查看表空间
select username,default_tablespace from dba_users;
16.插入10000条数据
declare aa NUMBER(10,0):=1;
begin
loop
insert into
student values (aa,‘aa‘);
aa:=aa+1;
exit when aa>1000;
end
loop;
end;
17.取前100条数据
标签:
原文地址:http://www.cnblogs.com/fangbaiyi/p/4569729.html