Monday, 20 June 2016

MongoDB wired tiger configuration

How to configure the wired tiger storage engine

Today I spent time configuring a mongoDB instance to use the wired tiger storage engine. This is the default in version 3.2 but has to be manually configured for prior versions. I found that the official documentation lists all the available options that can be specified, but does not show any useful YAML formatted examples of how the completed configuration file should look.

As such I though that this post would be useful for anyone else in a similar predicament.

To start, the storage.engine needs to be set to wiredTiger.

engine: "wiredTiger"

This is new in version 3.0 and the default in v3.2.

The other options we need to amend / update / include are:

cacheSizeGB - This value is a number and we should use the larger of either:

    60% of RAM minus 1 GB, or 1 GB.
               
journalCompressor - The Default is snappy. The option is used to set the type of compression which will be used to compress the WiredTiger journal data. Other available  compressors options are: none or zlib.

directoryForIndexes - The Default is false. This option determines whether mongodb should stores indexes and collections in separate sub-directories under the data directory.

blockCompressor - The Default is again snappy. This option determines the default type of compression to use to compress collection data. Other options are: none or zlib.

prefixCompression - The Default is true . This option enables or disables prefix compression for index data.

The completed storage of the config file should look similar to the below.


Links: 

DBA Stack Exchange - Sample YAML Configuration Files for MongoDB


Wednesday, 15 June 2016

Oracle – DB Temp flle has been deleted!

Actions to take when the temp file has been accidentally deleted


If the temp file is removed / deleted when the database is shut down then the DB is clever enough to realize that its missing and should create a new file when it’s brought back online.

[oracle@localhost ~]$ rm /home/oracle/app/oracle/oradata/orcl/temp01.dbf

[oracle@localhost orcl]$ ls
afiedt.buf                                       APEX_2614203650434107.dbf     redo03.log
APEX_1930613455248703.dbf     control01.ctl                                  sysaux01.dbf
APEX_2041602962184952.dbf     example01.dbf                               system01.dbf
APEX_2610402357158758.dbf     redo01.log                                     undotbs01.dbf
APEX_2611417663389985.dbf     redo02.log                                     users01.dbf

SQL> startup


[oracle@localhost orcl]$ ls
afiedt.buf                                        control01.ctl                   system01.dbf
APEX_1930613455248703.dbf      example01.dbf                temp01.dbf
APEX_2041602962184952.dbf      redo01.log                      undotbs01.dbf
APEX_2610402357158758.dbf      redo02.log                      users01.dbf
APEX_2611417663389985.dbf      redo03.log
APEX_2614203650434107.dbf      sysaux01.dbf

* Temp01 file has been magically re-created

If the database is up when the file is removed then you can manually re-create it on the fly as follows:

-- create a new temp file
ALTER TABLESPACE TEMP ADD TEMPFILE
'/home/oracle/app/oracle/oradata/orcl/temp02.dbf' SIZE 50M;

-- Drop the old file
ALTER TABLESPACE TEMP DROP TEMPFILE
'/home/oracle/app/oracle/oradata/orcl/temp01.dbf';

SQL> select file_name, tablespace_name from dba_temp_files;

FILE_NAME                                                                 TABLESPACE_NAME
/home/oracle/app/oracle/oradata/orcl/temp02.dbf       TEMP

Or if you are able to restart the database, then you can let the database re-create it for you.

[oracle@localhost ~]$ rm /home/oracle/app/oracle/oradata/orcl/temp02.dbf

SQL> shutdown immediate

SQL> startup

[oracle@localhost orcl]$ ls
afiedt.buf                                       control01.ctl                    system01.dbf
APEX_1930613455248703.dbf     example01.dbf                 temp02.dbf
APEX_2041602962184952.dbf     redo01.log                       undotbs01.dbf
APEX_2610402357158758.dbf     redo02.log                       users01.dbf
APEX_2611417663389985.dbf     redo03.log
APEX_2614203650434107.dbf     sysaux01.dbf