Adding Temporary Storage to a Database Deployment
This topic does not apply to Oracle Cloud Infrastructure.
In general, when you add storage to a database deployment on Oracle Database Classic Cloud Service, you want the storage to be permanent; that is, to remain attached and available until the deployment is deleted. To add this kind of permanent storage, scale up the storage as described in Scaling a Database Deployment.
However, you may sometimes want to add storage to a database deployment temporarily for a short period of time, after which you want to detach and delete the storage.
Topics
Adding Temporary Storage to a Database Deployment
To add temporary storage to a database deployment, you add a storage volume to a compute node. First, you create a Compute Cloud Service storage volume and attach it to the compute node. Then, while logged into the compute node you use Linux commands to partition, format and mount the storage volume.
The storage you add by following these steps is “temporary” in that you can later unmount it from the compute node and delete it. In all other ways it is “permanent”: it remains in existence, even if you delete the database deployment to which it is attached, until you delete it.
Note:
If the database deployment to which you attach this temporary storage is restarted or is stopped and then started, the storage volume becomes detached from the compute node and you must reattach it. For instructions, see Attaching a Storage Volume to an Instance in Using Oracle Cloud Infrastructure Compute Classic. After reattaching the storage volume, you must then connect to the compute node and remount it.
If the compute node is rebooted, such as when following the instructions in Rebooting a Compute Node, the temporary storage becomes unmounted and you must remount it.
When adding a Compute Cloud Service storage volume as temporary storage, keep these points in mind:
-
A compute node can have a maximum of ten storage volumes attached to it.
-
You can create a storage volume from 1 GB to 2048 GB in size, in increments of 1 GB.
To add temporary storage to a database deployment:
-
Use the Create Storage Volume wizard in the Compute Cloud Service console to create a storage volume.
Follow the instructions provided in Creating a Storage Volume in Using Oracle Cloud Infrastructure Compute Classic, choosing storage/default as the value for Storage Property.
-
Attach the storage volume to the Compute Cloud Service instance on which the compute node is running by following the instructions in Attaching a Storage Volume to an Instance in Using Oracle Cloud Infrastructure Compute Classic.
When you attach the storage volume, it is assigned a disk number. Note down this disk number for later use.
-
Connect as the
opc
user to the compute node.For detailed instructions, see Connecting to a Compute Node Through Secure Shell (SSH).
-
Start a root-user command shell:
$ sudo -s #
-
Confirm the addition of the storage volume by using the
ls
command:# ls /dev/xvd*
In the listing that is displayed, look for an entry of the form
/dev/xvdLETTER
, whereLETTER
is the letter that is alphabetically one higher than the storage volume’s disk number.For example, if the storage volume’s disk number is 6, you should look for the entry
/dev/xvdg
because the letter “g” is the seventh letter of the alphabet. -
Create a single, primary partition that occupies the entire storage volume by using the
fdisk
command. For example:# fdisk /dev/xvdg Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xaa660f6f. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): c DOS Compatibility flag is not set Command (m for help): u Changing display/entry units to sectors Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First sector (2048-20971519, default 2048): [press Enter] Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): [press Enter] Using default value 20971519 Command (m for help): p Disk /dev/xvdg: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xaa660f6f Device Boot Start End Blocks Id System /dev/xvdg1 2048 20971519 10484736 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
In this example, note the use of the
p
command to print the partition table before writing the table and exiting. Use this command and note down the name of the new partition as displayed in the Device column. -
Create a file system on the partition by using the
mkfs
command. For example:# mkfs -t ext4 /dev/xvdg1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 655360 inodes, 2621184 blocks 131059 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2684354560 80 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 32 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
-
Create a directory to use as the mount point for the partition by using the
mkdir
command. For example:# mkdir /u05
-
Mount the partition on the directory you just created by using the
mount
command. For example:# mount /dev/xvdg1 /u05
-
Set the ownership and permissions of the mount-point directory appropriately by using the
chown
andchmod
commands. For example:# chown oracle:oinstall /u05 # chmod 755 /u05
-
Exit the root-user command shell:
# exit $
Deleting Temporary Storage from a Database Deployment
To delete temporary storage, you unmount the storage on the compute node and then detach the storage volume from the Compute Cloud Service instance and delete it.
To delete temporary storage from a database deployment:
-
Connect as the
opc
user to the compute node.For detailed instructions, see Connecting to a Compute Node Through Secure Shell (SSH).
-
Start a root-user command shell:
$ sudo -s #
-
Display mounted filesystems and confirm the mount point of your temporary storage volume:
# df -hT
-
Unmount your temporary storage volume; for example:
# umount /u05
Note:
The Linux command to unmount a volume is
umount
(with no n). -
Exit the root-user command shell and disconnect from the compute node:
# exit exit $ exit
-
Open the Oracle Compute Cloud Service console.
For instructions, see Accessing Oracle Compute Cloud Service in Using Oracle Cloud Infrastructure Compute Classic.
When you open the Oracle Compute Cloud Service console, the Instances page is displayed .
-
Click Storage to display a list of storage volumes.
-
In the list of storage volumes, click the menu in the row for your temporary storage volume and choose Detach from Instance and then confirm the action.
-
Refresh the page occasionally until the row for your temporary storage no longer shows that it is attached.
-
From the menu in the row for your temporary storage volume, choose Delete and then confirm the action.
The Oracle Compute Cloud service sets the status of the storage volume to Deleting and begins deleting it.