oracle之user 管理

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:oracle之user 管理

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、profile管理
1、profile创建

create profile fei_profile limit
 sessions_per_user 1
 cpu_per_session 30000
 cpu_per_call 600
 connect_time 300
 idle_time 60
 logical_reads_per_session 300
 logical_reads_per_call 100
 failed_login_attempts 2
 password_life_time 1
 password_reuse_time 3
 password_reuse_max 10
 password_lock_time 1;

2、修改profile

alter profile fei_profile limit
connect_time 400
idle_time 200;

3、删除profile

drop profile fei_profile;

二、创建用户
1、准备工作

--查看表空间
select tablespace_name,contents from dba_tablespaces;
--查看默认临时表空间
select * from database_properties where property_name like '%TEMP_TABLE%';

2、创建用户
2.1数据库认证

create user abc
identified by abc
default tablespace abc
temporary tablespace temp
quota 10m on abc
quota 5m on users
password expire
account lock;

2.2、操作系统认证

--查看os_authent_prefix(前缀+操作系统用户名=数据库登陆名)
show parameter os_aut--查看结果为:OPS$
--创建用户
create user OPS$ff identified externally default tablespace abc;

三、修改用户

alter user abc account unlock;

四、删除用户

drop user abc cascade;--表示删除该用户下的所有objects

五、授权和回收
5.1、system级别权限

grant create session,create table to abc with admin option;--可以传递该授权(续传的权限不会被回收)
revoke create session,create table from abc;
grant create session,create table to fei identified by fei;
--用户不存在直接创建该用户,存在则修改用户密码

5.1.1权限类型

select * from session_privs;--查看本用户所具有的权限
ALTER SYSTEM
AUDIT SYSTEM
CREATE SESSION
ALTER SESSION
RESTRICTED SESSION
CREATE TABLESPACE
ALTER TABLESPACE
MANAGE TABLESPACE
DROP TABLESPACE
UNLIMITED TABLESPACE
CREATE USER
BECOME USER
ALTER USER
DROP USER
CREATE ROLLBACK SEGMENT
ALTER ROLLBACK SEGMENT
DROP ROLLBACK SEGMENT
CREATE TABLE
CREATE ANY TABLE
ALTER ANY TABLE
BACKUP ANY TABLE
DROP ANY TABLE
LOCK ANY TABLE
COMMENT ANY TABLE
SELECT ANY TABLE
INSERT ANY TABLE
UPDATE ANY TABLE
DELETE ANY TABLE
CREATE CLUSTER
CREATE ANY CLUSTER
ALTER ANY CLUSTER
DROP ANY CLUSTER
CREATE ANY INDEX
ALTER ANY INDEX
DROP ANY INDEX
CREATE SYNONYM
CREATE ANY SYNONYM
DROP ANY SYNONYM
SYSDBA
SYSOPER
CREATE PUBLIC SYNONYM
DROP PUBLIC SYNONYM
CREATE VIEW
CREATE ANY VIEW
DROP ANY VIEW
CREATE SEQUENCE
CREATE ANY SEQUENCE
ALTER ANY SEQUENCE
DROP ANY SEQUENCE
SELECT ANY SEQUENCE
CREATE DATABASE LINK
CREATE PUBLIC DATABASE LINK
DROP PUBLIC DATABASE LINK
CREATE ROLE
DROP ANY ROLE
GRANT ANY ROLE
ALTER ANY ROLE
AUDIT ANY
ALTER DATABASE
FORCE TRANSACTION
FORCE ANY TRANSACTION
CREATE PROCEDURE
CREATE ANY PROCEDURE
ALTER ANY PROCEDURE
DROP ANY PROCEDURE
EXECUTE ANY PROCEDURE
CREATE TRIGGER
CREATE ANY TRIGGER
ALTER ANY TRIGGER
DROP ANY TRIGGER
CREATE PROFILE
ALTER PROFILE
DROP PROFILE
ALTER RESOURCE COST
ANALYZE ANY
GRANT ANY PRIVILEGE
CREATE MATERIALIZED VIEW
CREATE ANY MATERIALIZED VIEW
ALTER ANY MATERIALIZED VIEW
DROP ANY MATERIALIZED VIEW
CREATE ANY DIRECTORY
DROP ANY DIRECTORY
CREATE TYPE
CREATE ANY TYPE
ALTER ANY TYPE
DROP ANY TYPE
EXECUTE ANY TYPE
UNDER ANY TYPE
CREATE LIBRARY
CREATE ANY LIBRARY
ALTER ANY LIBRARY
DROP ANY LIBRARY
EXECUTE ANY LIBRARY
CREATE OPERATOR
CREATE ANY OPERATOR
ALTER ANY OPERATOR
DROP ANY OPERATOR
EXECUTE ANY OPERATOR
CREATE INDEXTYPE
CREATE ANY INDEXTYPE
ALTER ANY INDEXTYPE
DROP ANY INDEXTYPE
UNDER ANY VIEW
QUERY REWRITE
GLOBAL QUERY REWRITE
EXECUTE ANY INDEXTYPE
UNDER ANY TABLE
CREATE DIMENSION
CREATE ANY DIMENSION
ALTER ANY DIMENSION
DROP ANY DIMENSION
MANAGE ANY QUEUE
ENQUEUE ANY QUEUE
DEQUEUE ANY QUEUE
CREATE ANY CONTEXT
DROP ANY CONTEXT
CREATE ANY OUTLINE
ALTER ANY OUTLINE
DROP ANY OUTLINE
ADMINISTER RESOURCE MANAGER
ADMINISTER DATABASE TRIGGER
MERGE ANY VIEW
ON COMMIT REFRESH
EXEMPT ACCESS POLICY
RESUMABLE
SELECT ANY DICTIONARY
DEBUG CONNECT SESSION
DEBUG ANY PROCEDURE
FLASHBACK ANY TABLE
GRANT ANY OBJECT PRIVILEGE
CREATE EVALUATION CONTEXT
CREATE ANY EVALUATION CONTEXT
ALTER ANY EVALUATION CONTEXT
DROP ANY EVALUATION CONTEXT
EXECUTE ANY EVALUATION CONTEXT
CREATE RULE SET
CREATE ANY RULE SET
ALTER ANY RULE SET
DROP ANY RULE SET
EXECUTE ANY RULE SET
EXPORT FULL DATABASE
IMPORT FULL DATABASE
CREATE RULE
CREATE ANY RULE
ALTER ANY RULE
DROP ANY RULE
EXECUTE ANY RULE
ANALYZE ANY DICTIONARY
ADVISOR
CREATE JOB
CREATE ANY JOB
EXECUTE ANY PROGRAM
EXECUTE ANY CLASS
MANAGE SCHEDULER
SELECT ANY TRANSACTION
DROP ANY SQL PROFILE
ALTER ANY SQL PROFILE
ADMINISTER SQL TUNING SET
ADMINISTER ANY SQL TUNING SET
CREATE ANY SQL PROFILE
EXEMPT IDENTITY POLICY
MANAGE FILE GROUP
MANAGE ANY FILE GROUP
READ ANY FILE GROUP
CHANGE NOTIFICATION
CREATE EXTERNAL JOB
--note:如果授权select any table 在默认情况下不能访问数据字典(O7_DICTIONARY_ACCESSIBILITY=false)
--如果修改O7_DICTIONARY_ACCESSIBILITY=true则可以访问数据字典

5.2、object级别授权与回收

grant select,update,delete on abc.abc_a to abc with grant option;--权限可以传递(如果被回收,续传下去的权限一并回收)
grant all on fei_a to abc;--把fei_a的所有相关操作授权给abc
revoke  select,update,delete on abc.abc_a from abc;
--note:update,insert可以指定表的列,而select不行,只能通过view实现限制功能

六、role的管理
6.1、role的创建

create role r_a;
create role r_b identified by r_b;

6.2/授权

grant create session to r_a;
grant create table to r_b;
grant r_a,r_b to b;--b为用户,把role授权给用户


6.3、查看role相关信息

select * from role_tab_privs where  ROLE LIKE 'R_%';
SELECT * FROM ROLE_SYS_PRIVS WHERE ROLE LIKE 'R_%';
SELECT * FROM ROLE_ROLE_privs where role like 'R_%';

6.4、设置default role 和enabl/disable role

alter user b default role r_a;
set role r_a,r_b identified by r_b;
--使用b用户登录,然后enable role r_a,r_b(注意密码)
--没有在set中写出来的role,表似乎disable

oracle之约束

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:oracle之约束

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一、not null

--创建表是直接指定
 create table orders(
 order_num number(4) constraint nn_orader_num not null,
 order_date date not null,
 product_id number);
--创建表后修改
alter table orders modify product_id not null;

二、check

--创建表时直接指定
 create table bouns(
 emp_id number not null,
 salary number(9,2) check(salary>500),
 bonus number(9,2),
 constraint ck_bonus check(bonus>100));
--创建表后修改
alter table bouns add constraint ck_bonus2 check(bonus<salary);
alter table bouns drop constraint ck_bonus2;--删除约束条件

三、unique

--最简单的创建
create table f3(id number unique);
--多列的索引
create table f4(id number,
name varchar2(20),
pwd varchar2(20),
constraint unique_f4 unique(id,pwd));
--添加unique和指定index相关信息
alter table fei
add constraint uq_fei_1np unique(id,pwd)
using index tablespace users
storage(initial 32k next 32k pctincrease 0) nologging;
--添加一列,包括unique
alter table fei add abc varchar2(11) constraint un_abc unique;
--删除unique
alter table d drop unique(id) cascade;--cascade可选(外键时强制删除)

四、primar key

--最基本的primary key
create table f5(id number primary key);
--主键为多列的情况
create table f6(id number,name varchar2(22),
constraint pk_f6 primary key(id,name));
--直接index的相关信息
create table f7(id number,name varchar2(20),
pwd varchar2(20),constraint pk_f7 primary key(id,pwd)
using index tablespace users
storage(initial 64k next 64k) nologging)
tablespace abc;
alter table a drop primary key cascade;--删除主键(外键时强制删除)

五、foreign key

--最简单的foreign key
create table a(id number primary key,name varchar2(10));
 create table b(id number references a(id));
--修改表的方式添加foreign key
create table c(id number,name varchar2(10));
alter table c add constraint fk_c foreign key(id) references a(id) on delete cascade;
--note:外键的三种删除方式:delete no action(default,如果外键中存在,主键中不能被删除)
--delete cascade(如果删除主键,强制删除外键中的内容)
--delete set null(删除主键,外键中内容变为null)
alter table c drop constraint fk_c;--删除外键约束

六、约束条件disable

alter table c add constraint pk_c  primary key(id) disable;
--noet:在创建条件后面加上disable
alter table c enable constraint pk_c;--启用约束性关系

七、(disable/enable)与(validate/novalidate)组成的四种状态

alter table a enable validate primary key;--(new、old数据都要检查)
alter table a enable novalidate primary key;--(new数据都要检查)
alter table a disable validate primary key;--(只读状态)
alter table a disable novalidate primary key;--(new、old数据都不检查)
select constraint_name,status,validated from user_constraints;--查询所属状态
--note:从disable novalidate状态转换为其他状态时,要考虑隐藏的unique index的存在

八、deferred延迟检查

alter table fei add constraint pk_fei primary key(id) deferrable;
set constraint pk_fei deferred;--或者set constraints all deferred;
--note:1)设置为deferrable时,如果建立隐形index则为NONUNIQUE
--2)建立constraint时,默认情况下是立即检查,而不是等到commit时检查
--3)如果没有set设置,默认还是为immediate(立即执行)

九、oracle约束状态转换冲突数据统计

--建立统计数据表
create table exceptions(row_id urowid,
 owner varchar2(30),
 table_name varchar2(30),
 constraint varchar2(30));
--创建表
create table t(id number primary key disable,name char(20));
--转换状态语句后面加exceptions into exceptions
alter table t enable validate primary key exceptions into exceptions;
--查看冲突数据
select rowid,id,name from t where rowid in (select row_id from exceptions);

oracle之index

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:oracle之index

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

--查看用户对象
SELECT OBJECT_NAME,OBJECT_TYPE FROM USER_OBJECTS;
--创建普通索引(指定pctfree,表空间,nologging模式)
create index fei_idx3 on fei(pwd,name) pctfree 20 tablespace users nologging;
--创建唯一索引
 create unique index fei_idx1 on fei(id) pctfree 20 tablespace users nologging;
--创建bitmap index
create bitmap index fei_idx1 on fei(id) pctfree 20 tablespace users nologging;
--修改索引空间大小(增大)
alter index fei_idx1 allocate extent(size 2000k
datafile 'C:\oracle\product\10.2.0\oradata\orcl\users01.dbf');
--释放索引未空间
alter index fei_idx1 deallocate unused;
--rebuild索引(在线索引重建)
alter index fei_idx1 rebuild online;
--删除索引
drop index fei_idx1;
--coalescing 索引(索引融合    相当于windows的磁盘整理功能)
alter index fei_idx1 coalesce;
--对索引分析(判断该索引是否要rebuild,主要参数是lf_rows,del_lf_rows的比例)
analyze index fei_idx1 validate structure offline;
select * from index_stats;
--监控索引使用情况
alter index fei_idx1 monitoring usage;--开启监控
select * from v$object_usage;--监控的结果
alter index fei_idx1 nomonitoring usage;--关闭监控
--查看执行计划
set autot on exp;--开启
set autot off;--关闭
--相关视图查询
select * from dba_ind_columns WHERE INDEX_OWNER='CHF';
select * from dba_indexes where owner='CHF';
SELECT * FROM DBA_IND_STATISTICS WHERE owner='CHF';

mysql 用户管理

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:mysql 用户管理

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、创建用户:
create user fei@’localhost’ identified by ‘fei’;
note:该用户没有授予任何访问权限,如果不加@’localhost’默认为“@%”
2、用户授权:
grant delete on test.* to fei@’localhost’ with grant option;
note:1)*表示test的任何对象,如果是*.*表示数据库中的所有对象
2)with grant option 表明fei用户可以把相关权限授给其他用户
3、权限回收:
revoke delete on test.* from fei@’localhost’;
4、创建用户授权一起实现
grant select,insert,update,delete on *.* to ‘fei2’@’%’
identified by ‘fei2’ with grant option;
note:在mysql中,如果@后面的登录范围不同,帐号可以一样
5、直接使用insert建立用户
insert into user(host,user,password,ssl_cipher,x509_issuer,x509_subject)
values(‘localhost’,’xff’,password(‘xff’),”,”,”);
FLUSH PRIVILEGES;
note:1)必须要加上ssl_cipher,x509_issuer,x509_subject三列,以为其默认值不为空(数据库版本为:5.0.51b)
2)FLUSH PRIVILEGES重载授权表,使权限更改生效
3)mysql是通过User表,Db表,Host表,Tables_priv 表,Columns_priv 表这5张表实现用户权限控制,均可以通过直接对这些表的操作以达到对用户的管理
6、删除用户:
drop user xff@localhost;(@不加默认为“%”)
7、授权精确到列:
grant select (cur_url,pre_url) on test.abc to fei@localhost;
8、修改root密码:
update mysql.user set password=password(‘passw0rd’) where user=’root’;
FLUSH PRIVILEGES;

oracle之表管理

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:oracle之表管理

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、创建session级别的临时表(commit后数据还会保留)
1)create global temporary table tem_session on commit preserve rows
as select rowid rid,id from a;
2) create global temporary table tem_fei(id number,a varchar2(10))
on commit preserve rows;
2、创建commit级别的临时表(commit后数据清空)
1)create global temporary table tem_xff on commit delete rows
as select * from a;
2)create global temporary table tem_a (id int,abc number)
on commit delete rows;
note:当session退出或者数据库重启后临时表会被清空,但是临时表的结构还是保存在数据库里面的,还是可以直接插入数据等操作
3、修改表的所属表空间
1)查看表所属表空间
select table_name,tablespace_name from user_tables;
2)查看哪些表空间
select name from v$tablespace;
3)修改表所属表空间
alter table a move tablespace users;
4、删除表中若干列
设置为unused
alter table tt set unused column z cascade constraints;
每次删除1000条提交commit
alter table tt drop unused columns checkpoint 1000;
如果中断继续执行
alter table tt drop columns continue checkpoint 1000;
直接删除一列
alter table tt drop column y;
5、查看表的结构

--1)desc
desc tablename
--2)dbms_metadata.get_ddl
set long 100000
 set pages 0
select dbms_metadata.get_ddl('TABLE','tablename') from dual;

oracle之undo

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:oracle之undo

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、创建undo表空间
create undo tablespace xff_undo datafile
‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\xff_undo1.dbf’
size 20m reuse autoextend on;
2、修改默认undo表空间
alter system set undo_tablespace=xff_undo;
3、查看undo中的transaction占用的block数目
select addr,used_ublk from v$transaction;
4、查看undo中的历史信息汇总
select begin_time,end_time,undoblks from v$undostat;
5、设置undo的过期时间(单位是s)
alter system set undo_retention=100;
6、决定undo大小
1)每秒钟undo的大小
select max(undoblks/(end_time-begin_time)*24*3600) from v$undostat;
2)undo的过期时间
show parameter undo_retention
3)oracle block的大小
show parameter db_block_size
4)上面三项相乘即为undo所需要的大小

mysql 使用二进制日志文件恢复数据库

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:mysql 使用二进制日志文件恢复数据库

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

在心中一直有个东西梗着,那就是mysql利用二进制日志文件恢复数据库,今天下决心解决这个问题,在网上查了些资料,然后自己的物理机上测试总是失败,开始一直怀疑是网上说的不正确,最后想起来自己的数据库是从5.0.1升级到5.1.49的,也许是因为升级的原因导致日志文件无法恢复,出现下面的错误
最后没有办法,在虚拟机上面新装个mysql 5.1.49的数据库进行测试,先启用日志功能:log-bin=bin_log,然后配置假定添加删除相关数据,模拟测试环境(新建表,添加数据,删除数据,添加数据,删除表)

use test;
create table test(id int auto_increment not null primary key,val int,data varchar(20));
insert into test(val,data) values(10,'liang');
insert into test(val,data) values(20,'jia');
insert into test(val,data) values(30,'hui');
flush logs;
insert into test(val,data) values(40,'aaa');
insert into test(val,data) values(50,'bbb');
insert into test(val,data) values(60,'ccc');
delete from test where id between 4 and 5;
insert into test(val,data) values(70,'ddd');
flush logs;
insert into test(val,data) values(80,'dddd');
insert into test(val,data) values(90,'eeee');
drop table test;

得到日志文件如下:

执行如下命令(dos要进入日志文件所在目录中)把二进制文件转化为记事本文件,方便查看:

mysqlbinlog bin_log.000001 >c:\1.txt
mysqlbinlog bin_log.000002 >c:\2.txt
mysqlbinlog bin_log.000003 >c:\3.txt


执行如下命令恢复数据库的删除数据和删除表操作

mysqlbinlog bin_log.000001 | mysql -uroot -p4020894
mysqlbinlog bin_log.000002 --stop-pos=861 | mysql -uroot -p4020894
mysqlbinlog bin_log.000002 --start-pos=965 | mysql -uroot -p4020894
mysqlbinlog bin_log.000003 --stop-pos=556 | mysql -uroot -p4020894

执行后的结果如:
上面语句相关说明:
1)stop-pos=861表示执行到861行停止,具体阅读2.txt文件(这里体现了二进制文件转化为文本文件的价值)
2)start-pos=965表示执行从965行开始
其他操作

mysqlbinlog bin_log.000001--读取日志文件在dos上显示
mysqlbinlog bin_log.000002 --stop-datetime="2010-08-19 14:49:39" |mysql -uroot -p4020894--基于停止时间点的恢复
mysqlbinlog bin_log.000001 --start-datetime="2010-08-19 14:48:25" |mysql -uroot  -p4020894--基于开始时间点的恢复
mysqlbinlog bin_log.000001 --start-datetime="2010-08-19 14:47:28" --stop-datetime="2010-08-19 14:48:41"|mysql -uroot -p4020894--基于开始与停止时间点的恢复
mysqlbinlog bin_log.000001 bin_log.000002 --start-datetime="2010-08-19 14:47:28" --stop-datetime="2010-08-19 14:50:13" |mysql -uroot -p4020894--多个日志文件的恢复

哈佛图书馆的二十条训言

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:哈佛图书馆的二十条训言

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1.此刻打盹,你将做梦;而此刻学习,你将圆梦。
2.我荒废的今日,正是昨日殒身之人祈求的明日。
3.觉得为时已晚的时候,恰恰是最早的时候。
4.勿将今日之事拖到明日。
5.学习时的苦痛是暂时的,未学到的痛苦是终生的。
6.学习这件事,不是缺乏时间,而是缺乏努力。
7.幸福或许不排名次,但成功必排名次。
8.学习并不是人生的全部。但既然连人生的一部分―――学习也无法征服,还能做什么呢?
9.请享受无法回避的痛苦。
10.只有比别人更早、更勤奋地努力,才能尝到成功的滋味。
11.谁也不能随随便便成功,它来自彻底的自我管理和毅力。
12.时间在流逝。
13.现在流的口水,将成为明天的眼泪。
14.狗一样地学,绅士一样地玩。
15.今天不走,明天要跑。
16.投资未来的人,是忠于现实的人。
17.受教育程度代表收入。
18.一天过完,不会再来。
19.即使现在,对手也不停地翻动书页。
20.没有艰辛,便无所获。

oracle之datafile,tablespace

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:oracle之datafile,tablespace

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

1、创建一般tablespace
create tablespace xifenfei datafile ‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\
xifenfei.DBF’ size 10m reuse autoextend on next 10m maxsize UNLIMITED ;
2、创建temp tablespace
create temporary tablespace xff_temp tempfile
‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\xff_temp.dbf’ size 10m;
3、创建undo tablespace
create undo tablespace xff_undo datafile
‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\xff_undo.dbf’ size 10m;
4、更改数据库的默认临时表空间
alter database default temporary tablespace xff_temp;
5、查询表空间类型
select tablespace_name,contents from dba_tablespaces;
6、查询默认临时表空间
select * from database_properties where property_name like ‘%TEMP_TABLE%’;
7、表空间变为只读状态
alter tablespace xifenfei read only;
note:该表空间中的objects可以被drop,因为表的记录是放在数据字典(system)中
8、表空间变为读写状态
alter tablespace xifenfei read write;
9、表空间offline
alter tablespace xifenfei offline;
note:如果有数据没有commit,会自动被commit掉
10、表空间online
alter tablespace xifenfei online;
11、查看表空间剩余大小

select f.tablespace_name,a.total,u.used,f.free,round((u.used/a.total)*100) "% used", round((f.free/a.total)*100) "% Free"
 from
 (select tablespace_name, sum(bytes/(1024*1024)) total
 from dba_data_files group by tablespace_name) a,
 (select tablespace_name, round(sum(bytes/(1024*1024))) used
 from dba_extents group by tablespace_name) u,
 (select tablespace_name, round(sum(bytes/(1024*1024))) free
 from dba_free_space group by tablespace_name) f
 WHERE a.tablespace_name = f.tablespace_name and a.tablespace_name = u.tablespace_name order by "% Free"; 

12、表空间自增长
alter database datafile ‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\XIFENFEI.DBF
‘ autoextend on next 2m maxsize 100m;
13、表空间中添加数据文件
alter tablespace xifenfei add datafile ‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\OR
CL\XIFENFEI1.DBF’ size 20m;
14、查看表空间是否是自增长
select file_name,autoextensible from dba_data_files;
15、修改表空间大小
alter database datafile ‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\
XIFENFEI1.DBF’ resize 15m;
16、查询临时表空间
select tablespace_name,file_name from dba_temp_files;
17、datafile  rename
1)alter tablespace xifenfei rename datafile
‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ XIFENFEI1.DBF’ to
‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\abc\ XIFENFEI1.DBF’
note:target文件必须存在,表空间必须离线
2) alter database rename file ‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\XIFENFEI1.DBF’
to ‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\orcl\XIFENFEI1.DBF’
note:target文件必须存在,数据库必须mount状态
18、删除表空间中的某个datafile
alter tablespace xifenfei drop datafile
‘C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\XIFENFEI1.DBF’;
19、删除表空间
drop tablespace xifenfei including contents and datafiles;

jquery插件弹出div

联系:手机/微信(+86 17813235971) QQ(107644445)

标题:jquery插件弹出div

作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]

一直在为弹出遮挡层的div烦恼着,今天网上找了下,发现jmpopups很不错,稍微修改下,基本上可以实现需要功能
总体HTML代码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <title>Untitled</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
 <script type="text/javascript" src="jquery.jmpopups-0.5.1.js"></script>
 <script type="text/javascript">
 //<![CDATA[
 $.setupJMPopups({
 screenLockerBackground: "#003366",
 screenLockerOpacity: "0.7"
 });
 function openStaticPopup() {
 $.openPopupLayer({
 name: "myStaticPopup",
 width: 400,
 target: "myHiddenDiv"
 });
 }
 //]]>
 </script>
 <style type="text/css" media="screen">
 #myHiddenDiv {display:none;}
 .popup {background:#FFF; border:1px solid #333; padding:1px;}
 .popup-header {height:24px; padding:7px; background:url("bgr_popup_header.jpg") repeat-x;}
 .popup-header h2 {margin:0; padding:0; font-size:18px; float:left;}
 .popup-header .close-link {float:right; font-size:11px;}
 .popup-body {padding:10px;}
 </style>
</head>
<body>
<a href="javascript:void();" onclick="openStaticPopup();" title="Static example">添加Flash信息</a>
 <div id="myHiddenDiv">
 <div>
 <div>
 <h2>添加Flash信息</h2>
 <a href="javascript:void();" onclick="$.closePopupLayer('myStaticPopup');" title="Close">Close</a>
 <br clear="all" />
 </div>
 <div>
 <table>
 <tr><td>选择图片</td><td>13123124124312413413</td></tr>
 <tr><td>选择图片</td><td>13123124124312413413</td></tr>
 <tr><td>选择图片</td><td>13123124124312413413</td></tr>
 <tr><td></td><td>提交</td></tr>
 </table>
 </div>
 </div>
 </div>
</body>
</html>

jmpopups代码:

(function($) {
 var openedPopups = [];
 var popupLayerScreenLocker = false;
 var focusableElement = [];
 var setupJqueryMPopups = {
 screenLockerBackground: "#000",
 screenLockerOpacity: "0.5"
 };
 $.setupJMPopups = function(settings) {
 setupJqueryMPopups = jQuery.extend(setupJqueryMPopups, settings);
 return this;
 }
 $.openPopupLayer = function(settings) {
 if (typeof(settings.name) != "undefined" && !checkIfItExists(settings.name)) {
 settings = jQuery.extend({
 width: "auto",
 height: "auto",
 parameters: {},
 target: "",
 success: function() {},
 error: function() {},
 beforeClose: function() {},
 afterClose: function() {},
 reloadSuccess: null,
 cache: false
 }, settings);
 loadPopupLayerContent(settings, true);
 return this;
 }
 }
 $.closePopupLayer = function(name) {
 if (name) {
 for (var i = 0; i < openedPopups.length; i++) {
 if (openedPopups[i].name == name) {
 var thisPopup = openedPopups[i];
 openedPopups.splice(i,1)
 thisPopup.beforeClose();
 $("#popupLayer_" + name).fadeOut(function(){
 $("#popupLayer_" + name).remove();
 focusableElement.pop();
 if (focusableElement.length > 0) {
 $(focusableElement[focusableElement.length-1]).focus();
 }
 thisPopup.afterClose();
 hideScreenLocker(name);
 });
 break;
 }
 }
 } else {
 if (openedPopups.length > 0) {
 $.closePopupLayer(openedPopups[openedPopups.length-1].name);
 }
 }
 return this;
 }
 $.reloadPopupLayer = function(name, callback) {
 if (name) {
 for (var i = 0; i < openedPopups.length; i++) {
 if (openedPopups[i].name == name) {
 if (callback) {
 openedPopups[i].reloadSuccess = callback;
 }
 loadPopupLayerContent(openedPopups[i], false);
 break;
 }
 }
 } else {
 if (openedPopups.length > 0) {
 $.reloadPopupLayer(openedPopups[openedPopups.length-1].name);
 }
 }
 return this;
 }
 function setScreenLockerSize() {
 if (popupLayerScreenLocker) {
 $('#popupLayerScreenLocker').height($(document).height() + "px");
 $('#popupLayerScreenLocker').width($(document.body).outerWidth(true) + "px");
 }
 }
 function checkIfItExists(name) {
 if (name) {
 for (var i = 0; i < openedPopups.length; i++) {
 if (openedPopups[i].name == name) {
 return true;
 }
 }
 }
 return false;
 }
 function showScreenLocker() {
 if ($("#popupLayerScreenLocker").length) {
 if (openedPopups.length == 1) {
 popupLayerScreenLocker = true;
 setScreenLockerSize();
 $('#popupLayerScreenLocker').fadeIn();
 }
 if ($.browser.msie && $.browser.version < 7) {
 $("select:not(.hidden-by-jmp)").addClass("hidden-by-jmp hidden-by-" + openedPopups[openedPopups.length-1].name).css("visibility","hidden");
 }
 $('#popupLayerScreenLocker').css("z-index",parseInt(openedPopups.length == 1 ? 999 : $("#popupLayer_" + openedPopups[openedPopups.length - 2].name).css("z-index")) + 1);
 } else {
 $("body").append("<div id='popupLayerScreenLocker'><!-- --></div>");
 $("#popupLayerScreenLocker").css({
 position: "absolute",
 background: setupJqueryMPopups.screenLockerBackground,
 left: "0",
 top: "0",
 opacity: setupJqueryMPopups.screenLockerOpacity,
 display: "none"
 });
 showScreenLocker();
 $("#popupLayerScreenLocker").click(function() {
 $.closePopupLayer();
 });
 }
 }
 function hideScreenLocker(popupName) {
 if (openedPopups.length == 0) {
 screenlocker = false;
 $('#popupLayerScreenLocker').fadeOut();
 } else {
 $('#popupLayerScreenLocker').css("z-index",parseInt($("#popupLayer_" + openedPopups[openedPopups.length - 1].name).css("z-index")) - 1);
 }
 if ($.browser.msie && $.browser.version < 7) {
 $("select.hidden-by-" + popupName).removeClass("hidden-by-jmp hidden-by-" + popupName).css("visibility","visible");
 }
 }
 function setPopupLayersPosition(popupElement, animate) {
 if (popupElement) {
 if (popupElement.width() < $(window).width()) {
 var leftPosition = (document.documentElement.offsetWidth - popupElement.width()) / 2;
 } else {
 var leftPosition = document.documentElement.scrollLeft + 5;
 }
 if (popupElement.height() < $(window).height()) {
 var topPosition = document.documentElement.scrollTop + ($(window).height() - popupElement.height()) / 2;
 } else {
 var topPosition = document.documentElement.scrollTop + 5;
 }
 var positions = {
 left: leftPosition + "px",
 top: topPosition + "px"
 };
 if (!animate) {
 popupElement.css(positions);
 } else {
 popupElement.animate(positions, "slow");
 }
 setScreenLockerSize();
 } else {
 for (var i = 0; i < openedPopups.length; i++) {
 setPopupLayersPosition($("#popupLayer_" + openedPopups[i].name), true);
 }
 }
 }
 function showPopupLayerContent(popupObject, newElement, data) {
 var idElement = "popupLayer_" + popupObject.name;
 if (newElement) {
 showScreenLocker();
 $("body").append("<div id='" + idElement + "'><!-- --></div>");
 var zIndex = parseInt(openedPopups.length == 1 ? 1000 : $("#popupLayer_" + openedPopups[openedPopups.length - 2].name).css("z-index")) + 2;
 }  else {
 var zIndex = $("#" + idElement).css("z-index");
 }
 var popupElement = $("#" + idElement);
 popupElement.css({
 visibility: "hidden",
 width: popupObject.width == "auto" ? "" : popupObject.width + "px",
 height: popupObject.height == "auto" ? "" : popupObject.height + "px",
 position: "absolute",
 "z-index": zIndex
 });
 var linkAtTop = "<a href='#' class='jmp-link-at-top' style='position:absolute; left:-9999px; top:-1px;'>&nbsp;</a><input class='jmp-link-at-top' style='position:absolute; left:-9999px; top:-1px;' />";
 var linkAtBottom = "<a href='#' class='jmp-link-at-bottom' style='position:absolute; left:-9999px; bottom:-1px;'>&nbsp;</a><input class='jmp-link-at-bottom' style='position:absolute; left:-9999px; top:-1px;' />";
 popupElement.html(linkAtTop + data + linkAtBottom);
 setPopupLayersPosition(popupElement);
 popupElement.css("display","none");
 popupElement.css("visibility","visible");
 if (newElement) {
 popupElement.fadeIn();
 } else {
 popupElement.show();
 }
 $("#" + idElement + " .jmp-link-at-top, " +
 "#" + idElement + " .jmp-link-at-bottom").focus(function(){
 $(focusableElement[focusableElement.length-1]).focus();
 });
 var jFocusableElements = $("#" + idElement + " a:visible:not(.jmp-link-at-top, .jmp-link-at-bottom), " +
 "#" + idElement + " *:input:visible:not(.jmp-link-at-top, .jmp-link-at-bottom)");
 if (jFocusableElements.length == 0) {
 var linkInsidePopup = "<a href='#' class='jmp-link-inside-popup' style='position:absolute; left:-9999px;'>&nbsp;</a>";
 popupElement.find(".jmp-link-at-top").after(linkInsidePopup);
 focusableElement.push($(popupElement).find(".jmp-link-inside-popup")[0]);
 } else {
 jFocusableElements.each(function(){
 if (!$(this).hasClass("jmp-link-at-top") && !$(this).hasClass("jmp-link-at-bottom")) {
 focusableElement.push(this);
 return false;
 }
 });
 }
 $(focusableElement[focusableElement.length-1]).focus();
 popupObject.success();
 if (popupObject.reloadSuccess) {
 popupObject.reloadSuccess();
 popupObject.reloadSuccess = null;
 }
 }
 function loadPopupLayerContent(popupObject, newElement) {
 if (newElement) {
 openedPopups.push(popupObject);
 }
 if (popupObject.target != "") {
 showPopupLayerContent(popupObject, newElement, $("#" + popupObject.target).html());
 } else {
 $.ajax({
 url: popupObject.url,
 data: popupObject.parameters,
 cache: popupObject.cache,
 dataType: "html",
 method: "GET",
 success: function(data) {
 showPopupLayerContent(popupObject, newElement, data);
 },
 error: popupObject.error
 });
 }
 }
 $(window).resize(function(){
 setScreenLockerSize();
 setPopupLayersPosition();
 });
 $(document).keydown(function(e){
 if (e.keyCode == 27) {
 $.closePopupLayer();
 }
 });
})(jQuery);

使用说明:
myHiddenDiv表示要弹出来的整体div
popup-body中的内容替换为你需要的内容
openStaticPopup();表示弹出div,锁定界面
$.closePopupLayer(‘myStaticPopup’);表示关闭div,解锁界面
<h2></h2>弹出div的标题
openStaticPopup中的width表示弹出div的宽度
其实就是细节上的调整
效果
jquery.jmpopups(弹出div,锁住界面)