Blog

How to Set SQL or Oracle Database to Single-User Mode and How to Check Single User or Multi User Mode

In Oracle database, place the instance in restricted mode.  The users already connected to the database will not get disconnected. You need to manually kill these sessions.

SQL> alter system enable restricted session;

OR

Startup in restricted mode.

SQL> startup restrict;

Check the instance mode

SQL> select logins from v$instance;

LOGINS
----------
RESTRICTED

In SQL database,  Below are the two most popular ways to set up database to single-user mode in SQL Server:

Using SQL Server Management Studio

Right-click the database to change, and then click Properties -> click the Options page->From the Restrict Access option, select Single.
If other users are connected to the database, an Open Connections message will appear. To change the property and close all other connections, click Yes.

Using Transact-SQL

USE master;
GO
ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO

Check SQL Database Single User or Multi User Mode

a)  Select ServerProperty(‘IsSingleUser’)

It should return 1, 0, or Null.

1 = Single user.
0 = Not single user
NULL = Input is not valid, or an error.

use MyDatabase
go
Select ServerProperty('IsSingleUser')

b) Select from sys.database,  it should retuen:

  • SINGLE_USER
  • MULTI_USER
SELECT user_access_desc 
FROM sys.databases 
WHERE name = 'MyDatabase'

3) From SSMS, Right-click the database , and then click Properties -> click the Options page->From the Restrict Access option.

How to Upgrade Linux OS In RAC Environment

This post introduces how to upgrade Linux OS from RHEL 5 to RHEL 7 with zero downtime for two nodes RAC. 

Subscribe to get access

Read more of this content when you subscribe today.

Deinstall 12.2.0.1 Grid Infrastructure Home After Being Upgraded to 18c GI

Grid Infrastructure 12.2.0.2 has been upgraded to 18c GI successfully. So 12.2.0.1 GI_HOME needs to be de-installed.  There are two ways to uninstall the old GI_HOME ( 12.2.0.1)

1) Detach GI_HOME and Remove the GI_HOME manually:

$ export ORACLE_HOME=/u01/app/grid/12.2.0.1
$ $ORACLE_HOME/OPatch/opatch lsinventory -all
$ cd $ORACLE_HOME/oui/bin
$ ./runInstaller -silent -detachHome ORACLE_HOME="/u01/app/grid/12.2.0.1"
$ unset ORACLE_HOME

-- as root user

# cd /u01/app/grid
# rm -fr 12.2.0.1

For any reason, if the above command fails, then on every node:

$ export ORACLE_HOME=/u01/app/grid/12.2.0.1 
$ $ORACLE_HOME/OPatch/opatch lsinventory -all 
$ cd $ORACLE_HOME/oui/bin 
$ ./runInstaller -silent -local -detachHome ORACLE_HOME="/u01/app/grid/12.2.0.1"
$ unset ORACLE_HOME
-- as root user
# cd /u01/app/grid
# rm -fr 12.2.0.1

2) Deinstall old GI_HOME by using “deinstall” tool :

a) Log in as root, change the permission and ownership of the old GI_HOME ( 12.2.0.1) on both nodes.

# chmod -R 755 /u01/app/12.2.0.1/grid
# chown -R grid /u01/app/12.2.0.1/grid
# chown grid /u01/app/12.2.0.1

b) Run “deinstall” under the to be deleted GI_HOME( /u01/app/12.2.0.1/grid).

$ /u01/app/12.2.0.1/grid/deinstall/deinstall

Checking for required files and bootstrapping ...
Please wait ...
Location of logs /u01/app/oraInventory/logs/

############ ORACLE DECONFIG TOOL START ############


######################### DECONFIG CHECK OPERATION START ################
## [START] Install check configuration ##
...
..
.

c) Refer and check the logs :

The Log of Deinstall 12.2.0.1 GI_HOME

How to Apply Grid Infrastructure RU/RUR Patches Before Upgrading GI from 12.2.0.1 to 18c

While upgrading GI from 12.2.0.1 to 18c, in order to minimize the downtime and reduce the impact on PROD environment,  Release Update(RU) or Release Update Reversion(RUR) patches can be applied onto new 18c GI image before setting up 18c GI.

Please note this way is different from what we normally do to apply RU/RUR patches according to patch README.html instruction.

  • RU/RUR can only be applied before 18c GI is configured (in other word, before root.sh or rootupgrade.sh is executed).
  • In this upgrade case, RU/RUR patches can only be applied onto the new 18c GI home,  patches are not to be applied to the existing (current) 12.2.0.1 GI home.
  • “opatchauto” and “opatch apply” must NOT be used as the new 18c GI home hasn’t been configured yet.

Here is the example of applying both RU/RUR patches sequentially against new 18c GI before starting to upgrade GI 12.2.0.1 to 18c.

Those following two patches will be applied on 18c GI gold imagine:

  • Patch 28828717 – GI Release Update 18.5.0.0.190115
  • Patch 29231062 – GI Release Update Revision 18.5.1.0.190416

Subscribe to get access

Read more of this content when you subscribe today.

How to Disable Transparent HugePages on Oracle Linux 7

It is recommended by Oracle to disable Linux native Transparent HugePages on Oracle database servers, to avoid potential Oracle database performance issues.

This post introduces how to disable Linux native Transparent HugePages, and verify Transparent Hugepages disabled or not.

Subscribe to get access

Read more of this content when you subscribe today.