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
Posted in 2017

Installing GI for Standalone

Yesterday I have installed GI for Standalone, I wanted to install my VBox with AFD, but I got this error. I don’t know, it’s sad I think.

AFD-620: AFD is not supported on this operating system version: 3.10.0-514.10.2.el7.x86_64

So I had to install asmlib and continue with. I don’t understand why I had to restart my machine, it was restarted before I started ./gridSetup.sh so it’s strange.

I had disks sdb and sdc prepared with fdisk. I don’t write about it again, it’s always the same.

[oracle@ora01 oracle]$ 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
sdc               8:32   0   12G  0 disk
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
sr0              11:0    1 1024M  0 rom

Now install the rpms

[root@ora01 ~]# yum install oracleasm-support 
[root@ora01 ~]# rpm -i /media/sf_12.2.0.1/oracleasmlib-2.0.12-1.el7.x86_64.rpm

Configuring oracleasm is always the same

[root@ora01 ~]# oracleasm configure -i
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

While initializing it I forgot a package

[root@ora01 ~]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": failed
Unable to load module "oracleasm"
[root@ora01 ~]#
[root@ora01 ~]# yum install kmod-oracleasm

Initialize oracleasm!

[root@ora01 ~]# oracleasm init
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm
[root@ora01 ~]#
[root@ora01 ~]# oracleasm createdisk disk1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@ora01 ~]# oracleasm createdisk disk2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@ora01 ~]#
[root@ora01 ~]#
[root@ora01 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@ora01 ~]# oracleasm listdisks
DISK1
DISK2

Now everything is prepared for the gridSetup.sh

[oracle@ora01 oracle]$ cd grid_12.2.0.1/
[oracle@ora01 grid_12.2.0.1]$ ./gridSetup.sh
Launching Oracle Grid Infrastructure Setup Wizard...

You can find the log of this install session at:
 /tmp/GridSetupActions2017-04-06_05-37-53PM/gridSetupActions2017-04-06_05-37-53PM.log
Moved the install session logs to:
 /products/oraInventory/logs/GridSetupActions2017-04-06_05-37-53PM

The root.sh exection failed of course and it wrote I need to restart the machine to continue.

Now I had to manually execute the steps when this error happens, nice thing Oracle, it’s documented and it worked without problems.

[root@ora01 oraInventory]# ./orainstRoot.sh
Changing permissions of /products/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /products/oraInventory to oinstall.
The execution of the script is complete.
[root@ora01 oraInventory]# cd ../
[root@ora01 products]# cd ora
oracle/       oraInventory/
[root@ora01 products]# cd oracle/grid_12.2.0.1/
[root@ora01 grid_12.2.0.1]# ./root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /products/oracle/grid_12.2.0.1
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /products/oracle/grid_12.2.0.1/crs/install/crsconfig_params
The log of current session can be found at:
  /products/oracle/crsdata/ora01/crsconfig/roothas_2017-04-06_05-46-45PM.log
2017/04/06 17:46:46 CLSRSC-363: User ignored prerequisites during installation
2017/04/06 17:46:52 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'ora01'
CRS-2673: Attempting to stop 'ora.evmd' on 'ora01'
CRS-2677: Stop of 'ora.evmd' on 'ora01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'ora01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.

ora01     2017/04/06 17:47:42     /products/oracle/grid_12.2.0.1/cdata/ora01/backup_20170406_174742.olr     0
2017/04/06 17:47:43 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

Now the last part was to generate a response file and run this type of command

[root@ora01 cfgtoollogs]# pwd
/products/oracle/grid_12.2.0.1/cfgtoollogs
[root@ora01 cfgtoollogs]# ./configToolAllCommands RESPONSE_FILE=/products/oracle/grid_12.2.0.1/cfgtoollogs/cfg.props
This script must not be run as root.
[oracle@ora01 ~]$ cat /products/oracle/grid_12.2.0.1/cfgtoollogs/cfg.props
oracle.assistants.asm|S_ASMPASSWORD=oracle
[oracle@ora01 cfgtoollogs]$ ./configToolAllCommands RESPONSE_FILE=/products/oracle/grid_12.2.0.1/cfgtoollogs/cfg.props

Finally it finished with a lot of warnings. But warnings are not problems.

After this I could start my asmca and create my ASM, it went smoothly. What I like to do on my VMs is to set these parameters, Oracle automatically sets AMM for GI to 1000MB and you cannot resize it to a lower value, it’s hardcoded. So you have to use ASMM

[oracle@ora01 trace]$ sqlplus / as sysasm

SQL*Plus: Release 12.2.0.1.0 Production on Thu Apr 6 18:06:42 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 memor

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
memory_max_target                    big integer 1076M
memory_target                        big integer 1076M
SQL> show parameter spf

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/ASM/ASMPARAMETERFILE/reg
                                                 istry.253.940615485
SQL> alter system set sga_target=300m scope=spfile ;

System altered.

SQL> alter system set memory_max_target=0 scope=spfile ;

System altered.

SQL> alter system set memory_target=0 scope=spfile ;

System altered.

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@ora01 trace]$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'ora01'
CRS-2673: Attempting to stop 'ora.evmd' on 'ora01'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'ora01'
CRS-2673: Attempting to stop 'ora.FRA.dg' on 'ora01'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'ora01'
CRS-2677: Stop of 'ora.FRA.dg' on 'ora01' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'ora01' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'ora01'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'ora01' succeeded
CRS-2677: Stop of 'ora.evmd' on 'ora01' succeeded
CRS-2677: Stop of 'ora.asm' on 'ora01' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'ora01'
CRS-2677: Stop of 'ora.cssd' on 'ora01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'ora01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[oracle@ora01 trace]$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[oracle@ora01 ~]$ sqlplus / as sysasm

SQL*Plus: Release 12.2.0.1.0 Production on Thu Apr 6 18:18:23 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 sga

Total System Global Area  314572800 bytes
Fixed Size                  8620224 bytes
Variable Size             280786752 bytes
ASM Cache                  25165824 bytes