Monday, April 14, 2014

Linux fdisk - new partitions with first sector 2048 instead of 63

I have some quantity of ocfs2 partitions on the storage area. They were created several years before with first sector of partition as 63. Once I needed to resize ocfs2 file system by increasing size of the volume on the SAN, deleting ocfs2 partition, creating new larger at the same place and resizing ocfs2 file system. But I noticed  I couldn't create new partition using fdisk with start on 63 sector but on 2048 instead.

Such behaviour can be explained by versions of fdisk. Older fdisk used dos disk label by defaul, newer doesn't. So, using

# fdisk -c=dos /dev/name_of_device

has solved the issue.

Wednesday, March 26, 2014

Dual boot of Windows and Linux. How to repair Windows loader after GRUB ?

If you've accidently destroyed/overwritten Master Boot Record of your hard disk installing Linux along with existing Windows, don't worry. Just log in as root to Linux and go to the boot partition. Here you can find file backup.mbr. That's backup of your MBR before GRUB overwrites it. Do the following:

1. Create new mbr copy (just in any case)

# dd if=/dev/ of=/boot/new_mbr_copy bs=1 count=512

2. Restore original MBR

# dd if=/boot/backup.mbr of=/dev/

Now you're able to boot Windows only, not Linux. In order to boot Linux, just install as an option EasyBCD boot loader, configure it and remember: in the future one should confugure Linux boot loader to be installed to it's boot partition only.

That's all

Monday, March 17, 2014

BLKRRPART: Device or resource busy - Linux error or similar message

Kernel can't permit you to explore newly added partitions without complete reboot of server. There are several ways to resolve it:

1.

partprobe [device]

2.

echo 1 > /sys/block//device/rescan

3.

hdparm -z \

4. etc.

After that you're able to create filesystem or use newly added partitons as you wish.

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