Experience: is what you get soon after you need it.

Experience: is what you get soon after you need it.

Rasul Allah (sal Allahu alaihi wa sallam) said: "Restore the trusts of those who trust you, and deal not falsely with him who deals falsely with you." [Abu Dawud, Tirmidhi]

Search This Blog

Friday, October 12, 2012

EXADATA X2-2 Creating DBFS fliesystem/share on EXADATA X2-2

 Environment:
EXADATA X2-2
OS: Linux
Image version: 11.2.3.2.0.120713
DB - 11.2.0.3

For Linux database servers, there are several steps to perform as root. Solaris database servers do not require this step and can

skip it. First, add the oracle user to the fuse group on Linux.  Run these commands as the root user.

(root)# dcli -g ~/dbs_group -l root usermod -a -G fuse oracle

Create the /etc/fuse.conf file with the user_allow_other option. Ensure proper privileges are applied to this file.

(root)# dcli -g ~/dbs_group -l root "echo user_allow_other > /etc/fuse.conf"
(root)# dcli -g ~/dbs_group -l root chmod 644 /etc/fuse.conf


For all database servers, create an empty directory that will be used as the mount point for the DBFS filesystem.

(root)# dcli -g ~/dbs_group -l root mkdir /dbfs_direct


[root@exadb01 onecommand]# pwd
/opt/oracle.SupportTools/onecommand

[root@exadb01 onecommand]# dcli -g dbs_group -l root mkdir /dbfs_share
[root@exadb01 onecommand]# dcli -g dbs_group -l root chown oracle:dba /dbfs_share
[root@exadb01 onecommand]#


exadb01.(MYDB1)  /home/oracle
>dba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 12 23:41:06 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> create bigfile tablespace dbfsts datafile '+DBFS_DG' size 32g autoextend on next 8g maxsize 300g NOLOGGING EXTENT MANAGEMENT

LOCAL AUTOALLOCATE  SEGMENT SPACE MANAGEMENT AUTO ;

Tablespace created.


QL>
SQL>  create user dbfs_user identified by default tablespace dbfsts quota unlimited on dbfsts;
SQL> grant create session, create table, create view, create procedure, dbfs_role to dbfs_user;


SQL> conn dbfs_user/
Connected.
SQL> start dbfs_create_filesystem dbfsts FS1
No errors.
--------
CREATE STORE:
begin dbms_dbfs_sfs.createFilesystem(store_name => 'FS_FS1', tbl_name =>
'T_FS1', tbl_tbs => 'dbfsts', lob_tbs => 'dbfsts', do_partition => false,
partition_key => 1, do_compress => false, compression => '', do_dedup => false,
do_encrypt => false); end;
--------
REGISTER STORE:
begin dbms_dbfs_content.registerStore(store_name=> 'FS_FS1', provider_name =>
'sample1', provider_package => 'dbms_dbfs_sfs'); end;
--------
MOUNT STORE:
begin dbms_dbfs_content.mountStore(store_name=>'FS_FS1', store_mount=>'FS1');
end;
--------
CHMOD STORE:
declare m integer; begin m := dbms_fuse.fs_chmod('/FS1', 16895); end;
No errors.


copy the script:

rw-r--r-- 1 oracle   oinstall 11592 Oct 13 00:09 mount-dbfs.sh

[root@exadb01 tmp]# dos2unix mount-dbfs.sh mount-dbfs.sh
dos2unix: converting file mount-dbfs.sh to UNIX format ...
dos2unix: converting file mount-dbfs.sh to UNIX format ...
[root@exadb01 tmp]#


Edit the variable settings in the top of the script for your environment. Edit or confirm the settings for the following

variables in the script. Comments in the script will help you to confirm the values for these variables.

    DBNAME
    MOUNT_POINT
    DBFS_USER
    ORACLE_HOME (should be the RDBMS ORACLE_HOME directory)
    LOGGER_FACILITY (used by syslog to log the messages/output from this script)
    MOUNT_OPTIONS
    DBFS_PASSWD (used only if WALLET=false)
    DBFS_PWDFILE_BASE (used only if WALET=false)
    WALLET (must be true or false)
    TNS_ADMIN (used only if WALLET=true)
    DBFS_LOCAL_TNSALIAS

After editing, copy the script (rename it if desired or needed) to the proper directory (GI_HOME/crs/script) on database nodes

and set proper permissions on it, as the root user:


[root@exadb01 onecommand]# dcli -g dbs_group -l root -d /u01/app/11.2.0.3/grid/crs/script -f /tmp/mount-dbfs.sh
[root@exadb01 onecommand]# dcli -g dbs_group -l root chown oracle:dba /u01/app/11.2.0.3/grid/crs/script/mount-dbfs.sh
[root@exadb01 onecommand]#  dcli -g dbs_group -l root chmod 750 /u01/app/11.2.0.3/grid/crs/script/mount-dbfs.sh



With the appropriate preparation steps for one of the two mount methods complete, the Clusterware resource for DBFS mounting can

now be registered. Register the Clusterware resource by executing the following as the RDBMS owner of the DBFS repository

database (typically "oracle") user. The ORACLE_HOME and DBNAME should reference your Grid Infrastructure ORACLE_HOME directory

and your DBFS repository database name, respectively. If mounting multiple filesystems, you may also need to modify the

ACTION_SCRIPT and RESNAME. For more information, see section below regarding Creating and Mounting Multiple DBFS Filesystems.

Create this short script and run it as the RDBMS owner (typically "oracle") on only one database server in your cluster.

##### start script add-dbfs-resource.sh
#!/bin/bash
ACTION_SCRIPT=/u01/app/11.2.0/grid/crs/script/mount-dbfs.sh
RESNAME=dbfs_mount
haanDBNAME=fsdb
DBNAMEL=`echo $DBNAME | tr A-Z a-z`
ORACLE_HOME=/u01/app/11.2.0/grid
PATH=$ORACLE_HOME/bin:$PATH
export PATH ORACLE_HOME
crsctl add resource $RESNAME \
  -type local_resource \
  -attr "ACTION_SCRIPT=$ACTION_SCRIPT, \
         CHECK_INTERVAL=30,RESTART_ATTEMPTS=10, \
         START_DEPENDENCIES='hard(ora.$DBNAMEL.db)pullup(ora.$DBNAMEL.db)',\
         STOP_DEPENDENCIES='hard(ora.$DBNAMEL.db)',\
         SCRIPT_TIMEOUT=300"
##### end script add-dbfs-resource.sh

Change it to:
##### start script add-dbfs-resource.sh
#!/bin/bash
ACTION_SCRIPT=/u01/app/11.2.0.3/grid/crs/script/mount-dbfs.sh
RESNAME=dbfs_share
DBNAME=MYDB
DBNAMEL=`echo $DBNAME | tr A-Z a-z`
ORACLE_HOME=/u01/app/11.2.0.3/grid
PATH=$ORACLE_HOME/bin:$PATH
export PATH ORACLE_HOME
crsctl add resource $RESNAME \
  -type local_resource \
  -attr "ACTION_SCRIPT=$ACTION_SCRIPT, \
         CHECK_INTERVAL=30,RESTART_ATTEMPTS=10, \
         START_DEPENDENCIES='hard(ora.$DBNAMEL.db)pullup(ora.$DBNAMEL.db)',\
         STOP_DEPENDENCIES='hard(ora.$DBNAMEL.db)',\
         SCRIPT_TIMEOUT=300"
##### end script add-dbfs-resource.sh
~






>vi add-dbfs-resource.sh
exadb01.(MYDB1)  /home/oracle/sshaik
>sh ./add-dbfs-resource.sh



exadb01.(MYDB1)  /home/oracle/sshaik
>srvctl stop database -d MYDB -f
exadb01.(MYDB1)  /home/oracle/sshaik
>srvctl start database -d MYDB


>crsctl stat res dbfs_share -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
dbfs_share
               OFFLINE OFFLINE      exadb01
               OFFLINE OFFLINE      exadb02
               OFFLINE OFFLINE      exadb03
               OFFLINE OFFLINE      exadb04

exadb01.(MYDB1)  /home/oracle/sshaik
> /u01/app/11.2.0.3/grid/bin/crsctl start resource dbfs_share
CRS-2672: Attempting to start 'dbfs_share' on 'exadb01'
CRS-2672: Attempting to start 'dbfs_share' on 'exadb02'
CRS-2672: Attempting to start 'dbfs_share' on 'exadb04'
CRS-2672: Attempting to start 'dbfs_share' on 'exadb03'
CRS-2676: Start of 'dbfs_share' on 'exadb01' succeeded
CRS-2676: Start of 'dbfs_share' on 'exadb04' succeeded
CRS-2676: Start of 'dbfs_share' on 'exadb03' succeeded
CRS-2676: Start of 'dbfs_share' on 'exadb02' succeeded


exadb01.(MYDB1)  /home/oracle/sshaik
> /u01/app/11.2.0.3/grid/bin/crsctl stat res dbfs_share -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
dbfs_share
               ONLINE  ONLINE       exadb01
               ONLINE  ONLINE       exadb02
               ONLINE  ONLINE       exadb03
               ONLINE  ONLINE       exadb04




    To unmount DBFS on all nodes, run this as the oracle user:
    (oracle)$ /bin/crsctl stop res dbfs_mount

    Note the following regarding restarting the database now that the dependencies have been added between the dbfs_mount

resource and the DBFS repository database resource.

    Note: After creating the dbfs_mount resource, in order to stop the DBFS repository database when the dbfs_mount resource is

ONLINE, you will have to specify the force flag when using srvctl. For example: "srvctl stop database -d fsdb -f". If you do not

specify the -f flag, you will receive an error like this:

    (oracle)$ srvctl stop database -d fsdb
    PRCD-1124 : Failed to stop database fsdb and its services
    PRCR-1065 : Failed to stop resource (((((NAME STARTS_WITH ora.fsdb.) && (NAME ENDS_WITH .svc)) && (TYPE == ora.service.type))

&& ((STATE != OFFLINE) || (TARGET != OFFLINE))) || (((NAME == ora.fsdb.db) && (TYPE == ora.database.type)) && (STATE !=

OFFLINE)))
    CRS-2529: Unable to act on 'ora.fsdb.db' because that would require stopping or relocating 'dbfs_mount', but the force option

was not specified

    Using the -f flag allows a successful shutdown and results in no output.

    Also note that once the dbfs_mount resource is started and then the database it depends on is shut down as shown above (with

the -f flag), the database will remain down. However, if Clusterware is then stopped and started, because the dbfs_mount resource

still has a target state of ONLINE, it will cause the database to be started automatically when normally it would have remained

down. To remedy this, ensure that dbfs_mount is taken offline (crsctl stop resource dbfs_mount) at the same time the DBFS

database is shutdown.








offnote:-

Note that the "crsctl stop cluster -all" syntax may not be used as it leaves ohasd running and Solaris database hosts require it

to be restarted for the workaround to take effect.

2 comments:

Anonymous said...

I am really satisfied with this posting that you have given us. This is really a stupendous work done by you. Thank you and looking for more posts

Anonymous said...

Just wish to say your article is as surprising. The clearness in your post is just great and i can assume you are an expert on this subject. Well with your permission let me to grab your feed to keep updated with forthcoming post. Thanks a million and please carry on the rewarding work.