Tuesday, January 31, 2017

How to set udev rules in ole6

How to set udev rules in ole6
Create the file:  vi /etc/udev/rules.d/50-udev.rules
KERNEL=="sdb1", OWNER="grid", GROUP="asmadmin", MODE="0644"
KERNEL=="sdc1", OWNER="grid", GROUP="asmadmin", MODE="0644"
KERNEL=="sdd1", OWNER="grid", GROUP="asmadmin", MODE="0644"
KERNEL=="sde1", OWNER="grid", GROUP="asmadmin", MODE="0644"
KERNEL=="sdf1", OWNER="grid", GROUP="asmadmin", MODE="0644"
KERNEL=="sdg1", OWNER="grid", GROUP="asmadmin", MODE="0644"
KERNEL=="sdh1", OWNER="grid", GROUP="asmadmin", MODE="0644"
KERNEL=="sdi1", OWNER="grid", GROUP="asmadmin", MODE="0644"

At the bottom of the file, add the new rules in the following format:
KERNEL==”blockdevicename”, OWNER=”deviceowner”, GROUP=”devicegroup”, MODE=”4digitpermissions”
1.      Block device name - the name of the block device.  For instance, if the device is listed as /dev/sda1, the block device name is sda1.
2.      Device owner - should be set to the name of the OS user that will own the block device.  For instance, if the device is going to be used for placement of the OCR, root should be the owner. For the voting disk or ASM disks, oracle should be the owner.
3.      Device group - should be set to the name of the group which owns the block device.  This will usually be oinstall or dba.
4.      4digitpermissions - should be set to the permissions mask of the block device.  For the OCR and ASM devices this will be 0640.  For the voting disk, it will usually be 0644.






After complete this restart Udev service
# /sbin/start_udev

Then,



Friday, January 20, 2017

SQL*Loader loads data from external files into tables of an Oracle database



SQL> create table test(ename varchar2(20),eno number(2),sal number(5));

Table created.

SQL> select * from tab;

TNAME       TABTYPE CLUSTERID
------------------------------ ------- ----------
BIN$P/EdWqqbIMzgU2gBqMALTQ==$0 TABLE
TEST       TABLE

$cd /u01/
$vi test.ctl
LOAD DATA
INFILE*
INTO TABLE TEST
fields terminated by','
(ename,eno,sal)
begindata
adeeb,23,565
pansoft,26,125
zubair,25,55
abdul,21,156
mahesh,56,147

[oracle@pansoft104 u01]$ export ORACLE_SID=dot
[oracle@pansoft104 u01]$ sqlldr userid=pansoft/pansoft control=test.ctl log=sqlldr.log direct=y

SQL*Loader: Release 11.2.0.4.0 - Production on Fri Oct 28 22:54:51 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Load completed - logical record count 5.
SQL> conn pansoft/pansoft;
Connected.
SQL> select * from test;

ENAME    ENO        SAL
-------------------- ---------- ----------
adeeb     23        565
pansoft     26        125
zubair     25 55
abdul     21        156
mahesh     56        147

[oracle@pansoft104 u01]$ vi sqlappend.ctl
LOAD DATA
INFILE *
append
INTO TABLE test
fields terminated by','
(ename,eno,sal)
begindata
append,15,236

[oracle@pansoft104 u01]$ sqlldr userid=pansoft/pansoft control=sqlappend.ctl log=sqlldr.log direct=y

SQL*Loader: Release 11.2.0.4.0 - Production on Fri Oct 28 23:03:44 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Load completed - logical record count 1.

SQL> conn pansoft/pansoft
Connected.
SQL> 
SQL> select * from test;

ENAME    ENO        SAL
-------------------- ---------- ----------
adeeb     23        565
pansoft     26        125
zubair     25 55
abdul     21        156
mahesh     56        147
append     15        236

6 rows selected.


Tuesday, January 17, 2017

How to drop database.

SQL> startup mount exclusive restrict;
ORACLE instance started.

Total System Global Area 1252663296 bytes
Fixed Size    2252824 bytes
Variable Size  788533224 bytes
Database Buffers  452984832 bytes
Redo Buffers    8892416 bytes
Database mounted.
SQL> drop database;

Database dropped.

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Sunday, January 15, 2017

Diagnostics Scripts for Concurrent Manager

Important Diagonistic Scripts for Concurrent Manager

R12

All scripts are inside $FND_TOP/sql.
1. afimchk.sql = Tell status of ICM and PMON.
2. afcmstat.sql = lists active manager processes.
3. afrqscm.sql = prints log file names of the managers.
4. afimlock.sql = lists the locks that ICM is waiting to get.

Saturday, January 7, 2017

Block media recovery using RMAN

SQL> create tablespace ts_corrupt datafile '/u01/app/oracle/oradata/ts_corrupt.dbf' size 100m;

Tablespace created.

SQL> create user usr_corrupt identified by usr_corrupt;

User created.

SQL> alter user usr_corrupt default tablespace
  2  ts_corrupt;

User altered.

SQL> conn / as sysdba
Connected.
SQL> grant connect,resource to usr_corrupt;

Grant succeeded.

SQL> desc dba_data_files;
 Name   Null?    Type
 ----------------------------------------- -------- ----------------------------
 FILE_NAME    VARCHAR2(513)
 FILE_ID    NUMBER
 TABLESPACE_NAME    VARCHAR2(30)
 BYTES    NUMBER
 BLOCKS    NUMBER
 STATUS    VARCHAR2(9)
 RELATIVE_FNO    NUMBER
 AUTOEXTENSIBLE    VARCHAR2(3)
 MAXBYTES    NUMBER
 MAXBLOCKS    NUMBER
 INCREMENT_BY    NUMBER
 USER_BYTES    NUMBER
 USER_BLOCKS    NUMBER
 ONLINE_STATUS    VARCHAR2(7)

SQL> select FILE_NAME,FILE_ID,TABLESPACE_NAME from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
   FILE_ID TABLESPACE_NAME
---------- ------------------------------
/u01/app/oracle/oradata/ben/users01.dbf
4 USERS

/u01/app/oracle/oradata/ben/undotbs01.dbf
3 UNDOTBS1

/u01/app/oracle/oradata/ben/sysaux01.dbf
2 SYSAUX


FILE_NAME
--------------------------------------------------------------------------------
   FILE_ID TABLESPACE_NAME
---------- ------------------------------
/u01/app/oracle/oradata/ben/system01.dbf
1 SYSTEM

/u01/app/oracle/oradata/ben/mill.dbf
5 MILL

/u01/app/oracle/oradata/ts_corrupt.dbf
6 TS_CORRUPT


6 rows selected.

SQL> conn usr_corrupt/usr_corrupt
Connected.
SQL> create table t_corrupt as select * from all_objects;

Table created.

SQL> select * from tab;

TNAME       TABTYPE CLUSTERID
------------------------------ ------- ----------
T_CORRUPT       TABLE

SQL> select SEGMENT_NAME,HEADER_FILE,HEADER_BLOCK from dba_segments where segment_name ='T_CORRUPT' and OWNER ='USR_CORRUPT';

SEGMENT_NAME
--------------------------------------------------------------------------------
HEADER_FILE HEADER_BLOCK
----------- ------------
T_CORRUPT
 6     130

[oracle@pansoft104 oradata]$ ls
ben  ts_corrupt01.dbf  ts_corrupt.dbf
[oracle@pansoft104 oradata]$ dd of=ts_corrupt.dbf bs=8192 conv=notrunc seek=135 << EOF

> CORRUPT
> EOF
0+1 records in
0+1 records out
9 bytes (9 B) copied, 7.5293e-05 s, 120 kB/s

SQL> alter system flush buffer_cache;

System altered.

SQL>  conn usr_corrupt/usr_corrupt;
Connected.
SQL>  select count(*) from t_corrupt;
 select count(*) from t_corrupt
                      *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 6, block # 135)
ORA-01110: data file 6: '/u01/app/oracle/oradata/ts_corrupt.dbf'

RMAN> BLOCKRECOVER DATAFILE 6 BLOCK 135;

Starting recover at 27-OCT-16
using channel ORA_DISK_1

channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00006
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/BEN/backupset/2016_10_27/o1_mf_nnndf_HEALTHY_d1491s80_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/BEN/backupset/2016_10_27/o1_mf_nnndf_HEALTHY_d1491s80_.bkp tag=HEALTHY
channel ORA_DISK_1: restored block(s) from backup piece 1
channel ORA_DISK_1: block restore complete, elapsed time: 00:00:01

starting media recovery
media recovery complete, elapsed time: 00:00:03

Finished recover at 27-OCT-16

RMAN> exit


Recovery Manager complete.

select count(*) from t_corrupt;

  COUNT(*)
----------
     68308

Featured post

Migrate OCR & vote from external to normal or High redundancy in ASM

How to Move OCR & Vote from external to Normal or high. 1)  Create New diskgroup(CRS) with suitable redundancy for OCR and Voting files....

Popular Posts