Author: Laurent Schneider

ANNOUNCEMENT: 12cR2 documentation is available

The doc is available. Check new features and stay tuned. Okay, just 12 for today : HIGH compressed index, case insensitive database with bound collation, partitioned external tables, AL32UTF8 default for new database, listagg overflow, VALIDATE_CONVERSION, approx_percentile, json_exists, flashback pluggable database, the SHARING clause, RAC streched clusters site definition and INACTIVE_ACCOUNT_TIME in profile. Some […]

OTN Appreciation Day : Partition your table online !

#ThanksOTN @oraclebase No, I am not talking about DBMS_REDEFINITION, where you get a kind of online feeling. No, I don’t want to rename my table, rename my foreign keys, my primary key, my not-null-constraints, recreate my referential integrity, recompile my triggers. I just want to partition a non-partitioned table. ALTER TABLE EMP MODIFY PARTITION BY […]

What is SID in Oracle ?

In the doc you’ll find, it’s the Oracle system identifier. Okay, let’s imagine the following Environment: ORACLE_SID=ORA001 init.ora: DB_NAME=DB001 DB_UNIQUE_NAME=UNI001 INSTANCE_NAME=INS001 SERVICE_NAMES=SVC001,SVC002 DB_DOMAIN=EXAMPLE.COM GLOBAL_NAMES=false database: SQL> select * from GLOBAL_NAME; listener.ora: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_NAME=GLO001.EXAMPLE.COM) (SID_NAME=ORA001) ) ) What is my SID? Actually there is more than one correct answer. In […]

column width change in 12c

In 11g I used to have 30 characters width in my dictionary SQL> select table_name, column_name from user_tab_columns; TABLE_NAME COLUMN_NAME —————————— —————————— BONUS COMM BONUS SAL BONUS JOB BONUS ENAME DEPT LOC DEPT DNAME DEPT DEPTNO EMP DEPTNO EMP COMM EMP SAL EMP HIREDATE TABLE_NAME COLUMN_NAME —————————— —————————— EMP MGR EMP JOB EMP ENAME EMP […]

powershell odbc sybase

Oracle goes there ==> …/oracle-odbc-hello-world-with-powershell.html To test Sybase ODBC driver with Powershell, it’s not much different configure the DsN with odbcconf or %SYSTEMROOT%\SysWOW64\odbcconf for the 32bits drivers under Windows 64. cmd /c “%SYSTEMROOT%\SysWOW64\odbcconf.exe /a {configdsn “”Adaptive Server Enterprise”” “”DSN=helloworld|database=mydb|port=25000|server=srv01″”}” The name of the driver is important. It is probably also called “Adaptive Server Enterprise” on […]

Generate 11g password hash

An easy way to generate a value string from the ssl is to use openssl Let’s take a random salt of ABCDEFGHIJ. The length of 10 is important. The hexadecimal representation is -41-42-43-44-45-46-47-48-49-4A- $ echo “SafePassw0rDABCDEFGHIJ\c” | openssl dgst -sha1 (stdin)= 47cc4102144d6e479ef3d776ccd9e0d0158842bb With this hash, I can construct my value SQL> create user testuser identified […]

delete all data

How do you delete all data? The simplistic approach would be to truncate all tables SQL> select table_name from user_tables; TABLE_NAME ———- T1 SQL> truncate table t1; Table truncated. You cannot truncate if you have referential integrity constraints. SQL> truncate table t2; ORA-02266: unique/primary keys in table referenced by enabled foreign keys Ok, let’s disable […]

tracefile tim to readable date format

In trace file, the time is recorded, this could be used to measure time between two timestamps But how do you convert 31796862227375 to a human format? This is how I proceeded : SQL> oradebug SETMYPID Statement processed. SQL> oradebug tracefile_name /u01/log/oracle/diag/rdbms/db01/DB01/trace/DB01_ora_32440740.trc SQL> alter session set nls_date_format=’YYYY-MM-DD_HH24:MI:SS’ sql_trace=true; Session altered. SQL> select ‘&_DATE’,’Start’ from dual; […]

job_name cannot be null

exec dbms_scheduler.create_job(job_name=>null,job_type=>’PLSQL_BLOCK’,job_action=>’BEGIN NULL; END;’) ORA-27451: JOB_NAME cannot be NULL ORA-06512: at “SYS.DBMS_ISCHED”, line 146 ORA-06512: at “SYS.DBMS_SCHEDULER”, line 288 ORA-06512: at line 1 This sounds like a proper error message. A bit less obvious is the drop_job message SQL> exec dbms_scheduler.drop_job(job_name=>null) ORA-20001: comma-separated list invalid near ORA-06512: at “SYS.DBMS_UTILITY”, line 236 ORA-06512: at “SYS.DBMS_UTILITY”, line […]

Irrecoverable full backup part II : reporting

After my post Can you restore from a full online backup ?, I needed to come up with a report. Assuming that each backup goes in a different directory, I just wrote two reports. Report gaps in v$backup_redolog (or rc_backup_redolog if you use the catalog) DIR FIRST_CHANGE# NEXT_CHANGE# ——- ————- ———— /bck01/ 284891 285140 /bck01/ […]

Can you restore from a full online backup ?

The question is not HOW TO DO IT but WHETHER YOU CAN DO IT ! A typical backup script would contains something like BACKUP DATABASE PLUS ARCHIVELOG: backup database format ‘/u99/backup/DB01/20150518/full_0_%d_s%s_p%p’ plus archivelog format ‘/u99/backup/DB01/20150518/arc_%d_s%s_p%p’; Starting backup at 2015-05-18_18:27:55 current log archived input archived log thread=1 sequence=469 … piece handle= /u99/backup/DB01/20150518/arc_DB01_s86_p1 Finished backup at 2015-05-18_18:27:58 […]

run sudo, ssh, password, su in simulated interactive mode

Some commands do not like non-interactive mode $ passwd newpassword > newpassword > EOF Changing password for user lsc. Current password for passwd: Authentication token manipulation error $ echo oraclepassword | su – oracle standard in must be a tty $ echo sudopassword | sudo su – oracle [sudo] password for lsc: sudo: sorry, […]

bypass ora-20

When you really need to run one script, at all cost, an annoying error is ORA-00020: maximum number of processes (40) exceeded, which can even occurs as sysdba. Test case (21 is a not something to do in real life): SQL> alter system set processes=21 scope=spfile; System altered. SQL> startup force quiet ORACLE instance started. […]