标签云
asm恢复 bbed bootstrap$ dul kcbzib_kcrsds_1 kccpb_sanity_check_2 kcratr_nab_less_than_odr MySQL恢复 obet ORA-00312 ORA-00704 ORA-00742 ORA-01110 ORA-01200 ORA-01555 ORA-01578 ORA-01595 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-600 kcratr_nab_less_than_odr ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 ORACLE恢复 Oracle 恢复 ORACLE数据库恢复 oracle碎片 OSD-04016 YOUR FILES ARE ENCRYPTED 比特币加密文章分类
- MongoDB (1)
- MongoDB恢复 (1)
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (112)
- 数据库 (1,884)
- DB2 (22)
- MySQL (82)
- Oracle (1,709)
- Data Guard (53)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (168)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (73)
- Oracle Bug (8)
- Oracle RAC (56)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (662)
- Oracle安装升级 (108)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (91)
- PostgreSQL (37)
- pdu工具 (7)
- PostgreSQL恢复 (13)
- SQL Server (34)
- SQL Server恢复 (14)
- TimesTen (7)
- 达梦数据库 (5)
- 达梦恢复 (3)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (51)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (34)
- MongoDB (1)
-
最近发表
- 记录19c ASM磁盘掉线触发ORA-59048故障处理
- aix平台Oracle数据库由于断电无法启动故障处理
- 断电引起ORA-600 3005故障处理
- 记录一次云存储资源到期之后引起的数据库恢复
- Firebird 损坏数据库数据抢救工具—firebirdext
- Oracle 19c 202610补丁(RUs+OJVM)-19.33
- 由于con$.con#值达到极限,触发数据库增加约束报ORA-600 12807错误
- MongoDB 离线提取工具—mongoext
- .bres勒索病毒加密数据库dmp文件可恢复
- ORA-600 krsm_mrp_rebuild_lf_list.lno_mismatch
- 记录一次0丢失的ORA-00354: 损坏重做日志块标头故障恢复
- 不当数据库恢复操作导致一个月数据丢失
- obet快速修复oracle 位图损坏块
- 不太常见的10.2.0.1的oracle redo损坏恢复
- obet forcecopy功能抢救硬件故障中的数据文件
- kcratr_nab_less_than_odr和system坏块故障处理
- 通过obet 恢复system坏块,打开数据库
- obet dbv功能完整说明
- 分享一例运行在aix上的sap系统数据库恢复过程
- OBET-Oracle Block Editor Tool使用说明
分类目录归档:数据库
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
评论关闭
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';
发表在 Oracle
评论关闭
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;
发表在 MySQL
评论关闭

加我微信(17813235971)
加我QQ(107644445)

