Monday, December 30, 2013

How to create dblink using encrypted password (identified by values)

1. Often there are situations where one needs create database link but doesn't know destination schema password, only name of schema is known. The password (identified by values 'long_string_of_values') can be selected from the output (on destination database) using command

SQL> select dbms_metadata.get_ddl ('USER',username) from dual ;

'identified by values' part of the output can be used in create database link statement, an also for create another user with the same password.

This works only with versions of Oracle Database till 11.2.0.4 in cases of creating/duplicating database links, but this 'technique' can be used to prolong expired schema passwords on databases 11.2.0.4 and newer.

2. Another 'solution' working only with versions of Oracle Database till 11.2.0.4, can be used to obtain password string from existing database link.

There is a view called KU$_DBLINK_VIEW. In column PASSWORDX it contains encrypted dblink-like password (not like in USER$). That string can be used as password in clause identified by values of CREATE DATABASE LINK command:

SQL> create database link link_name connect to username identified by values 'PASSWORDX' using 'connect_string' ;

3. From 11.2.0.4 and further, there are two possible options :
- using plane passwords in db_link statement ("identified by ", not by "identified by values ...") ;
- using expdp/impdp solution for duplicating database link. The passwords are kept as its were, but renaming of database link is not supported (there are no remap_dblink parameter for impdp). It is possible to solve it by unsupported way - modify name in link$ system table with flushing of shared pool aftermath.

PS. In Oracle9i the passwords of database links' destination schemas were kept in plane text in link$ dictionary table and in ku$_dblink_view also.

Good Luck !!!

Sunday, December 8, 2013

How to change Oracle resource autostart option (AUTO_START)


In CRS (GI) versions before 12c, to view resource's autostart option, run

> crs_stat -p resource_name

and find the line :
AUTO_START=0 - start resource after starting crsd if it was up before 
AUTO_START=1 - start resource after starting crsd AUTO_START=2 - do not start resource after starting crsd

To change that use next actions.
1. Create resource profile from CRS registry as file as

> crs_stat -p resource_name > /CRS_HOME/crs/public/resource_name.cap

2. Edit the profile using text editor.

3. Unregister resource

> crs_unregister resource_name

4. Register resource

> crs_register resource_name

5. Check the resourse's profile

> crs_stat -p resource_name

P.S. In recent versions of Grid Infrastructure (from 12c) you could use :

> crsctl modify resource resource_name -attr AUTO_START={always|restore|never} -unsupported 

or

> srvctl modify resource_type -policy {automatic|manual|norestart|useronly}

These values are quite different in their meaning (you can always consult the documentation about it), but crsctl AUTO_START=restore is equivalent to srvctl policy automatic.

Good Luck !

Saturday, November 23, 2013

FAL[client]: All defined FAL servers have been attempted

In case when all setting of your primary and standby database (10gR2) related to detecting gaps are correct, the following might help you. I made it after learning info from enabling log_archive_trace.

 Due to bugs if value of log_archive_max_processes>1 it's possible to trap into such situation. Resolution is set

alter system set log_archive_max_processes=1 sid='*'

In my case all standbies started to resolving gaps.

Tuesday, November 12, 2013

Linux-x86_64 Error: 12: Cannot allocate memory

When you're trying to start the Oracle instance, you can get this error in following reasons.

The cause of appearing depends not only on the following:

1. Improper configuration of sga parameters.

2. /proc/sys/kernel/shmmax (max size of one shared memory segment in bytes) ;

3. /proc/sys/kernel/shmmni (max number of shared memory segments in the system) ;

4.  /proc/sys/kernel/shmall (max size of memory in 4kB pages which can be occupied by shared memory segments)

4. ulimit -[S|H]l kBs
max locked memory, can be set in /etc/security/limits.conf as
oracle  soft    memlock unlimited
oracle  hard    memlock unlimited

5. ulimit -[S|H]m kBs
max memory size, can be set in /etc/security/limits.conf as
oracle  soft    rss unlimited
oracle  hard    rss unlimited

...

But aslo it depends on the settings of
ulimit -[S|H]v kBs - virtual memory, which can be set in :
- /etc/sysconfig/ulimit (if exists, in SLES11 a hard limit is set to 80 percent of total memory, in SLES10 it's set to unlimited) ;
- .profile or similar files (for example, ulimit -H -v unlimited).

P.S. Don't forget to configure huge pages properly, if they're used.
P.P.S. Don't put much memory to SGA due to possible swapping/paging, although it depends on a task and application(s).

OSs SLES 10/11 x86_64 were used

Tuesday, September 3, 2013

How to make bootable a USB stick with installation media of openSuSE (12.3), using syslinux

There is a custom case. We have formatted fat32 usb stick. We would like to keep untouched files on the stick, i.e. simple dd if=...iso of=usb_stick_device is not fit to us.
So, the next is how to...

1. Download installation media and copy it to the root directory of the stick.

2. Run

syslinux /dev/stick_device

dd if=/usr/share/syslinux/mbr.bin of=/dev/stick_device

Mark the partition on the stick active using fdisk or parted or other tools.

3. mount usb stick and installation media.

4. Copy from isntallation media catalog /boot//loader into /boot/syslinux

5. create file /boot/syslinux/syslinux.cfg like 

default linux
label linux
kernel linux
append initrd=initrd ramdisk_size=512000 ramdisk_blocksize=4096 install=hd:/openSUSE-12.3-DVD-i586.iso

6. Boot from usb stick and perform installation.

Thursday, August 29, 2013

How to refresh multipath configuration without server restarting

We use SAN for Oracle RAC databases. SAN organized via QLogic HBA's among other things. Hardware is HP's.

Quite often we need add new disks, or new filesystems, or new partitions etc. on storage area, which requires rebuilding our multipath configuration. How to do in without restarting the server ? Follow the next.

1. Present newly created disk to the server inside storage configuration.

2. Rescan all HBAs by

hp_rescan -a.

3. Restart multipathd.

4. Update /etc/multipath.conf (if necessary, in case  of new disk names, for an instance).

5. Run

multipath -ll

and create necessary partition table (with help of fdisk, for example) on one of the devices, related to the new disk.

6. Update partition table of other devices, related to the new disk, using

blockdev --rereadpt device_name

7. Update multipath device using

kpartx -a /dev/mapper/multipath_device_name

8. At that point you can create filesystem on it.