Posted in 2016

Oracle FS 12.2 New Feature

.While reading Oracle 12.2 New Features I discovered that we can create filesystems on tablespaces. So I had to try it and it works, but somehow wrong.

Docs used:

Database PL/SQL Packages and Types Reference

In the Large Objects guide you will not find very much: 😀

Database SecureFiles and Large Objects Developer’s Guide

I am using ASM so I decided to create a new diskgroup, I used the /dev/sde1 device for the new diskgroup OFS, I like to have everything ordered.

[oracle@ora01 data]$ lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0  476M  0 part /boot
└─sda2            8:2    0 15.3G  0 part
  ├─ol-root     253:0    0   14G  0 lvm  /
  └─ol-products 253:2    0 23.3G  0 lvm  /products
sdb               8:16   0   12G  0 disk
└─sdb1            8:17   0   12G  0 part
sdc               8:32   0   12G  0 disk
└─sdc1            8:33   0   12G  0 part
sdd               8:48   0   30G  0 disk
└─sdd1            8:49   0 25.7G  0 part
  ├─ol-swap     253:1    0  3.7G  0 lvm  [SWAP]
  └─ol-products 253:2    0 23.3G  0 lvm  /products
sde               8:64   0   20G  0 disk
└─sde1            8:65   0   20G  0 part
sr0              11:0    1 1024M  0 rom

As you see it’s 20GB.

First we have to create a tablespace:

[oracle@ora01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Apr 12 12:24:37 2017

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> show parameter create

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
create_bitmap_area_size              integer     8388608
create_stored_outlines               string
db_create_file_dest                  string      +DATA
db_create_online_log_dest_1          string
db_create_online_log_dest_2          string
db_create_online_log_dest_3          string
db_create_online_log_dest_4          string
db_create_online_log_dest_5          string
SQL> alter session set db_create_file_dest='+OFS' ;

Session altered.

SQL> create tablespace OFS datafile size 20000m ;

Tablespace created.

SQL> select file_name from dba_data_files ;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/CDB1/DATAFILE/system.261.940672671
+DATA/CDB1/DATAFILE/sysaux.263.940672691
+DATA/CDB1/DATAFILE/undotbs1.265.940672693
+DATA/CDB1/DATAFILE/users.269.940672735
+OFS/CDB1/DATAFILE/ofs.256.941113555

So let’s create the ofs filesystem:

SQL> exec dbms_fs.make_oracle_fs(fstype=>'ofs',fsname=>'ofs_fs1',fsoptions=>'TABLESPACE=OFS')

PL/SQL procedure successfully completed.

Create the directory:

[oracle@ora01 ~]$ sudo mkdir -p /ofs/data
[oracle@ora01 ~]$ sudo chown -R oracle:oinstall /ofs/data

Mount it:

SQL> exec dbms_fs.mount_oracle_fs(fstype=>'ofs',fsname=>'ofs_fs1',mount_point=>'/ofs/data',mount_options=>'default_permissions, allow_other, persist');
BEGIN dbms_fs.mount_oracle_fs(fstype=>'ofs',fsname=>'ofs_fs1',mount_point=>'/ofs/data',mount_options=>'default_permissions, allow_other, persist'); END;

*
ERROR at line 1:
ORA-17676: Failed to mount 'ofs_fs1' with error:'Generic ofslib mount error'
ORA-06512: at "SYS.DBMS_FS", line 25
ORA-06512: at line 1

Ahh I forgot to install fuse

[root@ora01 ~]# yum install fuse
[root@ora01 ~]# usermod -a -G fuse oracle
[root@ora01 ~]# cat /etc/fuse.conf
# mount_max = 1000
user_allow_other

[root@ora01 ~]# reboot

Once the DB was up again I could create the filesystem

[oracle@ora01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed Apr 12 12:51:15 2017

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> exec dbms_fs.mount_oracle_fs(fstype=>'ofs',fsname=>'ofs_fs1',mount_point=>'/ofs/data',mount_options=>'default_permissions, allow_other, persist');

PL/SQL procedure successfully completed.

OK, great we have it! check it on OS

[oracle@ora01 ~]$ df -hT
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/ol-root     xfs        14G  3.8G   11G  28% /
devtmpfs                devtmpfs  986M     0  986M   0% /dev
tmpfs                   tmpfs    1001M     0 1001M   0% /dev/shm
tmpfs                   tmpfs    1001M  8.5M  992M   1% /run
tmpfs                   tmpfs    1001M     0 1001M   0% /sys/fs/cgroup
/dev/mapper/ol-products xfs        24G   20G  3.7G  85% /products
/dev/sda1               xfs       473M  194M  280M  41% /boot
12.2.0.1                vboxsf    3.4T  2.3T  1.2T  67% /media/sf_12.2.0.1
tmpfs                   tmpfs     201M     0  201M   0% /run/user/54321
/dev/fuse               fuse       32G     0   32G   0% /ofs/data
[oracle@ora01 data]$ ls -ld /ofs/
drwxr-xr-x. 3 oracle oinstall 17 Apr 12 12:36 /ofs/
[oracle@ora01 data]$ ls -ld /ofs/data/
drwxrwxrwx. 1 nobody nobody 2048 Apr 12 12:30 /ofs/data/

It’s there, but do you see it???

/dev/fuse               fuse       32G     0   32G   0% /ofs/data

My diskgroup and tablespace is only 20GB.. and that’s a problem I think.

To have it complete, I unmount it too.

SQL> exec dbms_fs.unmount_oracle_fs(fsname=>'ofs_fs1',mount_point=>'/ofs/data')

PL/SQL procedure successfully completed.

Wow, I generated an ORA-600, after dropping the tablespace without unmounting it, creating this error:

ORA-00600: internal error code, arguments: [ksfsmLookup-p], [942], [ORA-00942: table or view does not exist

----- Abridged Call Stack Trace -----
ksedsts()+346<-kjzduptcctx()+868<-kjzdicrshnfy()+1113<-ksuitm_opt()+1678<-ksbrdp()+4494<-opirip()+609<-opidrv()+602<-sou2o()+145<-opimai_real()+202<-ssthrdmain()+417<-skgp_thread_async_main()+338<-start_thread()+197

Advertisements

Author:

Database administrator who loves to work with Oracle software. (Sometimes not)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s