Monthly Archives: 八月 2013

PK FK 命令小记

0

Posted on by

PK:

–增加

alter table AAA  add constraint aaa primary key (USERNAME);

ALTER TABLE AAA ADD CONSTRAINT aaa PRIMARY KEY(username) USING INDEX

 ALTER TABLE AAA ADD CONSTRAINT aaa PRIMARY KEY(username) USING INDEX aaa;

–删除

 ALTER TABLE AAA DROP PRIMARY KEY CASCADE; 

 alter table AAA  drop constraint bbb 

 alter table AAA  drop constraint bbb cascade

[……]

查看全文

Categories: SQL

PRCR-1079 ORA-01031 CRS-2674 SRVCTL Fails to Start Database in Oracle Restart Job Role Separation Environment

0

Posted on by

在Install Grid Infrastructure for standalone server dbca到97%时,报错:PRCR-1079,ORA-01031,ORA-01031等错误。

 

PRCR-1079 ORA-01031 CRS-2674 SRVCTL Fails to Start Database in Oracle Restart Job Role Separation Environment

手动执行start 也报错:

[grid@history ~]$ srvctl start database -d history
PRCR-1079 : Failed to start resource ora.history.db
ORA-01031: insufficient privileges
CRS-5017: The resource action "ora.history.db start" encountered the following error: 
ORA-01031: insufficient privileges
. For details refer to "(:CLSN00107:)" in "/u01/ap[......]

查看全文

NLS_LENGTH_SEMANTICS参数说明

0

Posted on by

      在oracle中有NLS_LENGTH_SEMANTICS这个参数,他有两个取值,CHAR和BYTE。默认取值为BYTE,当为CHAR时字符类型的长度是按字符个数来计算,而不是按BYTE来计算,一般情况数据库都会使用UTF-8编码,一个汉字如果按字节存放就需要3个字节。同时NLS_LENGTH_SEMANTICS对于属于SYS的表(对SYSTEM有效)无效。

 

看字段用的char和byte的sql为:

select owner,
       table_name,
       data_type,
       decode(char_used, 'C', 'char', 'B', 'BYTE') char_used,
       DATA_LENGTH,
       column_name
  from dba_tab_columns
 where data_type like '%C[......]

查看全文

Copy Archivelog Files From ASM to Filesystem

0

Posted on by

数据库归档放在ASM里时,想把他CP出来是比较蛋疼的一件事。现在推荐了几个方法。

10g:

       1.用rman copy方式

     RMAN> backup as copy archivelog from sequence 5 until sequence 5 thread 1 format '/u01/app/%h_%e_archivelog.dbf';


     RMAN> backup as copy archivelog  sequence between 5 and 6 thread 1 format '/u01/app/%h_%e_archivelog.dbf';

       2.调用dbms_file_transfer.copy_file包

SQL> create directory  asm_dir&nbs[......]

查看全文

12c PDB监听设置

1

Posted on by

        在12c database中所有的CDB,PDB都是共用一个监听的,怎么样关闭某一个PDB的监听,而不影响别的数据库的连接。可以用DBMS_SERVICE来关闭相应的SERVICE来阻止客户端的连接。

 

—需要会话切到PDB

alter session set container=pdb1;

 

服务的关闭:

SQL>  exec DBMS_SERVICE.stop_SERVICE('pdb1');

PL/SQL procedure successfully completed.

 

服务的开启:

SQL> exec DBMS_SERVICE.start_SERVICE('pdb1');

PL/SQL procedure successfully completed.

 [……]

查看全文

第 1 页,共 2 页12