Master Note for Handling Oracle Database Corruption Issues
Very useful document
| Master Note for Handling Oracle Database Corruption Issues (Doc ID 1088018.1) |
Oct 9
Very useful document
| Master Note for Handling Oracle Database Corruption Issues (Doc ID 1088018.1) |
DDL Extract for tables
ALL Tables from user
set heading off;
set echo off;
Set pages 999;
set long 90000;
spool export_tables_ddl.sql
select dbms_metadata.get_ddl(‘TABLE’,table_name,’TESTUSER’) from user_tables;
spool off
*table_name — Don’t mention anything
A table
select dbms_metadata.get_ddl(‘TABLE’,’EMPLOYEE’) from dual
*EMPLOYEE – table name
While doing restore controlfile to new host in windows server, getting below issue
ORA-19963: error getting logical block size of file F:\BACKUP\O1_MF_S_966071800_
F6C0G8CF_.BKP
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 5) Access is denied.
Solution :
Windows, you need to give full permission of directory to users which contents of backup files.
Jan 22
I am trying to restore the database to new host, While doing the first step, I try to start the database,
SQL> startup nomount pfile=’F:\backup\init.ORA’;
ORA-32006: SEC_CASE_SENSITIVE_LOGON initialization parameter has been deprecated
ORA-00600: internal error code, arguments: [kmgs_component_init_5], [15], [], []
, [], [], [], [], [], [], [], []
Solution :
The below error message appeared in the alert log file.
ORA-27102: out of memory
OSD-00026: additional error information
O/S-Error: (OS 1455) The paging file is too small for this operation to complete.
Mon Jan 22 14:21:37 2018
Error: Failed to allocate SGA start_addr 00000007D0000000 size 134217728
It seems to be a Memory issue on the server. I have crosschecked the server RAM and init.ora file Memory target size. The Server RAM size is lesser than memory target size. so I have adjusted the memory target size in init.ora file according to the Server RAM and tried to start the database as a nomount stage, its okay.
Or you need to increase RAM on the server if you need more.
Jan 18
Please find the document here
Jan 15
In Oracle Database12c, SQL*Loader has a new feature called express mode that makes loading CSV files faster and easier. With express mode, there is no need to write a control file for most CSV files you load. Instead, you can load the CSV file with just a few parameters on the SQL*Loader command line.
Example :
SQL> create table dept(deptno number,deptname varchar2(20),deptlocation varchar2(20));
Table created.
SQL> desc dept;
Name Null? Type
—————————————– ——– —————————-
DEPTNO NUMBER
DEPTNAME VARCHAR2(20)
DEPTLOCATION VARCHAR2(20)
oracle:oradb]$ cat testload.dat
001,IT Dept,Riyadh
002,Accounting,Riyadh
003,HR Dept,Bahrain
[premiadb:oracle:testdb]$ sqlldr userid=testme data=testload.dat table=dept
Password:
SQL*Loader: Release 12.1.0.2.0 – Production on Mon Jan 15 09:28:42 2018
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Express Mode Load, Table: DEPT
Path used: External Table, DEGREE_OF_PARALLELISM=AUTO
Table DEPT:
3 Rows successfully loaded.
Check the log files:
dept.log
dept_%p.log_xt
for more information about the load.
[premiadb:oracle:testdb]$ sqlplus testme
SQL*Plus: Release 12.1.0.2.0 Production on Mon Jan 15 09:28:58 2018
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Enter password:
Last Successful login time: Mon Jan 15 2018 09:28:45 +03:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> select * from dept;
DEPTNO DEPTNAME DEPTLOCATION
———- ——————– ——————–
1 IT Dept Riyadh
2 Accounting Riyadh
3 HR Dept Bahrain
For more detail, Please refer
Click to access sqlldr-express-mode-wp-1991038.pdf
C:\Users\mazar>sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sun Jan 7 14:15:59 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Solution: added ora_dba group to user
C:\Windows\system32>net localgroup
C:\Windows\system32>net localgroup ora_dba mazar /add
The command completed successfully.
C:\Users\mazar>sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sun Jan 7 14:21:45 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 – 64bit Production
SQL>
create trigger open_all_pdbs
after startup on database
begin
execute immediate ‘alter pluggable database all open’;
end open_all_pdbs;
/
Step 1:
select * from dba_db_links
Step 2: create a procedure
Create or replace procedure Drop_DbLink(schemaName varchar2, dbLink varchar2 ) is
plsql varchar2(1000);
cur number;
uid number;
rc number;
begin
select
u.user_id into uid
from dba_users u
where u.username = schemaName;
plsql := ‘drop database link “‘||dbLink||'”‘;
cur := SYS.DBMS_SYS_SQL.open_cursor;
SYS.DBMS_SYS_SQL.parse_as_user(
c => cur,
statement => plsql,
language_flag => DBMS_SQL.native,
userID => uid
);
rc := SYS.DBMS_SYS_SQL.execute(cur);
SYS.DBMS_SYS_SQL.close_cursor(cur);
end;
/
Step 3: Drop database link using sys
exec Drop_DbLink(‘owner’,’dblinkname’);