Google Cloud Platform
Here is some links to the docs of the gcloud commands used in this post ...
gcloud compute instances describe
gcloud compute instances list
gcloud compute disks describe
gcloud compute disks create
gcloud compute instances attach-disk
gcloud compute instances detach-disk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@em13c ~]# cat /etc/redhat-release | |
Red Hat Enterprise Linux Server release 7.2 (Maipo) | |
[root@em13c ~]# gcloud components update | |
Your current Cloud SDK version is: 0.9.85 | |
You will be upgraded to version: 92.0.0 | |
┌────────────────────────────────────────────────────────┐ | |
│ These components will be updated. │ | |
├─────────────────────────────────┬────────────┬─────────┤ | |
│ Name │ Version │ Size │ | |
├─────────────────────────────────┼────────────┼─────────┤ | |
│ BigQuery Command Line Tool │ 2.0.18 │ < 1 MiB │ | |
│ Cloud SDK Core Libraries │ 2016.01.12 │ 3.1 MiB │ | |
│ Cloud Storage Command Line Tool │ 4.16 │ 2.6 MiB │ | |
│ Default set of gcloud commands │ │ │ | |
└─────────────────────────────────┴────────────┴─────────┘ | |
┌────────────────────────────────────────────────────────────────────────────┐ | |
│ These components will be installed. │ | |
├─────────────────────────────────────────────────────┬────────────┬─────────┤ | |
│ Name │ Version │ Size │ | |
├─────────────────────────────────────────────────────┼────────────┼─────────┤ | |
│ BigQuery Command Line Tool (Platform Specific) │ 2.0.18 │ < 1 MiB │ | |
│ Cloud SDK Core Libraries (Platform Specific) │ 2015.11.24 │ < 1 MiB │ | |
│ Cloud Storage Command Line Tool (Platform Specific) │ 4.15 │ < 1 MiB │ | |
└─────────────────────────────────────────────────────┴────────────┴─────────┘ | |
For the latest full release notes, please visit: | |
https://cloud.google.com/sdk/release_notes | |
Do you want to continue (Y/n)? y | |
╔════════════════════════════════════════════════════════════╗ | |
╠═ Creating update staging area ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Uninstalling: BigQuery Command Line Tool ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Uninstalling: Cloud SDK Core Libraries ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Uninstalling: Cloud Storage Command Line Tool ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Uninstalling: Default set of gcloud commands ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Installing: BigQuery Command Line Tool ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Installing: Cloud SDK Core Libraries ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Installing: Cloud SDK Core Libraries (Platform Specific) ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Installing: Cloud Storage Command Line Tool ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Installing: Default set of gcloud commands ═╣ | |
╠════════════════════════════════════════════════════════════╣ | |
╠═ Creating backup and activating new installation ═╣ | |
╚════════════════════════════════════════════════════════════╝ | |
Start a new shell for the changes to take effect. | |
Update done! | |
[root@em13c ~]# gcloud compute disks list | |
NAME ZONE SIZE_GB TYPE STATUS | |
data us-east1-b 100 pd-standard READY | |
em13c us-east1-b 10 pd-standard READY | |
fra us-east1-b 50 pd-standard READY | |
ocrv1 us-east1-b 10 pd-standard READY | |
ocrv2 us-east1-b 10 pd-standard READY | |
ocrv3 us-east1-b 10 pd-standard READY | |
ora us-east1-b 75 pd-standard READY | |
[root@em13c ~]# gcloud compute disks create --size="50GB" --zone=us-east1-b asm-data1 | |
WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks/persi | |
stent-disks#pdperformance. | |
Created [https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/disks/asm-data1]. | |
NAME ZONE SIZE_GB TYPE STATUS | |
asm-data1 us-east1-b 50 pd-standard READY | |
[root@em13c ~]# gcloud compute disks list | |
NAME ZONE SIZE_GB TYPE STATUS | |
asm-data1 us-east1-b 50 pd-standard READY | |
data us-east1-b 100 pd-standard READY | |
em13c us-east1-b 10 pd-standard READY | |
fra us-east1-b 50 pd-standard READY | |
ocrv1 us-east1-b 10 pd-standard READY | |
ocrv2 us-east1-b 10 pd-standard READY | |
ocrv3 us-east1-b 10 pd-standard READY | |
ora us-east1-b 75 pd-standard READY | |
[root@em13c ~]# gcloud compute disks describe asm-data1 --zone us-east1-b | |
creationTimestamp: '2016-01-19T08:38:13.404-08:00' | |
id: '4213006549044680858' | |
kind: compute#disk | |
name: asm-data1 | |
selfLink: https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/disks/asm-data1 | |
sizeGb: '50' | |
status: READY | |
type: https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/diskTypes/pd-standard | |
zone: https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b | |
[root@em13c ~]# gcloud compute disks create --size="75GB" --zone=us-east1-b asm-fra1 | |
WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks/persistent-disks#pdperformance. | |
Created [https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/disks/asm-fra1]. | |
NAME ZONE SIZE_GB TYPE STATUS | |
asm-fra1 us-east1-b 75 pd-standard READY | |
[root@em13c ~]# gcloud compute disks list | |
NAME ZONE SIZE_GB TYPE STATUS | |
asm-data1 us-east1-b 50 pd-standard READY | |
asm-fra1 us-east1-b 75 pd-standard READY | |
data us-east1-b 100 pd-standard READY | |
em13c us-east1-b 10 pd-standard READY | |
fra us-east1-b 50 pd-standard READY | |
ocrv1 us-east1-b 10 pd-standard READY | |
ocrv2 us-east1-b 10 pd-standard READY | |
ocrv3 us-east1-b 10 pd-standard READY | |
ora us-east1-b 75 pd-standard READY | |
[root@em13c ~]# gcloud compute instances describe em13c --zone us-east1-b | grep deviceName | |
deviceName: em13c | |
deviceName: ora | |
deviceName: data | |
deviceName: fra | |
deviceName: ocrv1 | |
deviceName: ocrv2 | |
deviceName: ocrv3 | |
[root@em13c ~]# gcloud compute instances attach-disk em13c --disk asm-data1 --zone us-east1-b | |
Updated [https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/instances/em13c]. | |
[root@em13c ~]# gcloud compute instances attach-disk em13c --disk asm-fra1 --zone us-east1-b | |
Updated [https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/instances/em13c]. | |
[root@em13c ~]# gcloud compute instances describe em13c --zone us-east1-b | grep deviceName | |
deviceName: em13c | |
deviceName: ora | |
deviceName: data | |
deviceName: fra | |
deviceName: ocrv1 | |
deviceName: ocrv2 | |
deviceName: ocrv3 | |
deviceName: persistent-disk-7 | |
deviceName: persistent-disk-8 | |
[root@em13c ~]# Detach and Attach with the right deviceName. | |
[root@em13c ~]# gcloud compute instances detach-disk em13c --disk asm-data1 --zone us-east1-b | |
Updated [https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/instances/em13c]. | |
[root@em13c ~]# gcloud compute instances detach-disk em13c --disk asm-fra1 --zone us-east1-b | |
Updated [https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/instances/em13c]. | |
[root@em13c ~]# gcloud compute instances attach-disk em13c --disk asm-data1 --device-name asm-data1 --zone us-east1-b | |
Updated [https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/instances/em13c]. | |
[root@em13c ~]# gcloud compute instances attach-disk em13c --disk asm-fra1 --device-name asm-fra1 --zone us-east1-b | |
Updated [https://www.googleapis.com/compute/v1/projects/***********/zones/us-east1-b/instances/em13c]. | |
[root@em13c ~]# gcloud compute instances describe em13c --zone us-east1-b | grep deviceName | |
deviceName: em13c | |
deviceName: ora | |
deviceName: data | |
deviceName: fra | |
deviceName: ocrv1 | |
deviceName: ocrv2 | |
deviceName: ocrv3 | |
deviceName: asm-data1 | |
deviceName: asm-fra1 | |
[root@em13c ~]# lsblk | |
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT | |
sda 8:0 0 10G 0 disk | |
└─sda1 8:1 0 10G 0 part / | |
sdb 8:16 0 75G 0 disk | |
└─sdb1 8:17 0 75G 0 part /u01 | |
sdc 8:32 0 100G 0 disk | |
└─sdc1 8:33 0 100G 0 part /u02 | |
sdd 8:48 0 50G 0 disk | |
└─sdd1 8:49 0 50G 0 part /u03 | |
sde 8:64 0 10G 0 disk | |
└─sde1 8:65 0 10G 0 part | |
sdf 8:80 0 10G 0 disk | |
└─sdf1 8:81 0 10G 0 part | |
sdg 8:96 0 10G 0 disk | |
└─sdg1 8:97 0 10G 0 part | |
sdh 8:112 0 50G 0 disk | |
sdi 8:128 0 75G 0 disk | |
[root@em13c ~]# ls -ltra /dev/sd[h-i] | |
brw-rw----. 1 root disk 8, 112 Jan 19 17:03 /dev/sdh | |
brw-rw----. 1 root disk 8, 128 Jan 19 17:04 /dev/sdi | |
[root@em13c ~]# fdisk /dev/sdh | |
Welcome to fdisk (util-linux 2.23.2). | |
Changes will remain in memory only, until you decide to write them. | |
Be careful before using the write command. | |
Device does not contain a recognized partition table | |
Building a new DOS disklabel with disk identifier 0x2b77232c. | |
The device presents a logical sector size that is smaller than | |
the physical sector size. Aligning to a physical sector (or optimal | |
I/O) size boundary is recommended, or performance may be impacted. | |
Command (m for help): p | |
Disk /dev/sdh: 53.7 GB, 53687091200 bytes, 104857600 sectors | |
Units = sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 4096 bytes | |
I/O size (minimum/optimal): 4096 bytes / 4096 bytes | |
Disk label type: dos | |
Disk identifier: 0x2b77232c | |
Device Boot Start End Blocks Id System | |
Command (m for help): | |
Command (m for help): n | |
Partition type: | |
p primary (0 primary, 0 extended, 4 free) | |
e extended | |
Select (default p): p | |
Partition number (1-4, default 1): | |
First sector (2048-104857599, default 2048): | |
Using default value 2048 | |
Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): | |
Using default value 104857599 | |
Partition 1 of type Linux and of size 50 GiB is set | |
Command (m for help): w | |
The partition table has been altered! | |
Calling ioctl() to re-read partition table. | |
Syncing disks. | |
[root@em13c ~]# fdisk /dev/sdi | |
Welcome to fdisk (util-linux 2.23.2). | |
Changes will remain in memory only, until you decide to write them. | |
Be careful before using the write command. | |
Device does not contain a recognized partition table | |
Building a new DOS disklabel with disk identifier 0x692b04ee. | |
The device presents a logical sector size that is smaller than | |
the physical sector size. Aligning to a physical sector (or optimal | |
I/O) size boundary is recommended, or performance may be impacted. | |
Command (m for help): n | |
Partition type: | |
p primary (0 primary, 0 extended, 4 free) | |
e extended | |
Select (default p): p | |
Partition number (1-4, default 1): | |
First sector (2048-157286399, default 2048): | |
Using default value 2048 | |
Last sector, +sectors or +size{K,M,G} (2048-157286399, default 157286399): | |
Using default value 157286399 | |
Partition 1 of type Linux and of size 75 GiB is set | |
Command (m for help): w | |
The partition table has been altered! | |
Calling ioctl() to re-read partition table. | |
Syncing disks. | |
[root@em13c ~]# ls -l /dev/sd[h-i]* | |
brw-rw----. 1 root disk 8, 112 Jan 19 17:57 /dev/sdh | |
brw-rw----. 1 root disk 8, 113 Jan 19 17:57 /dev/sdh1 | |
brw-rw----. 1 root disk 8, 128 Jan 19 17:57 /dev/sdi | |
brw-rw----. 1 root disk 8, 129 Jan 19 17:57 /dev/sdi1 | |
[root@em13c ~]# oracleasm listdisks | |
OCRV1 | |
OCRV2 | |
OCRV3 | |
[root@em13c ~]# oracleasm createdisk DATA1 /dev/sdh1 | |
Writing disk header: done | |
Instantiating disk: done | |
[root@em13c ~]# oracleasm createdisk FRA1 /dev/sdi1 | |
Writing disk header: done | |
Instantiating disk: done | |
[root@em13c ~]# oracleasm listdisks | |
DATA1 | |
FRA1 | |
OCRV1 | |
OCRV2 | |
OCRV3 | |
[grid@em13c bin]$ ./kfod disks=all | |
-------------------------------------------------------------------------------- | |
Disk Size Path User Group | |
================================================================================ | |
1: 51199 Mb ORCL:DATA1 | |
2: 76799 Mb ORCL:FRA1 | |
3: 10239 Mb ORCL:OCRV1 | |
4: 10239 Mb ORCL:OCRV2 | |
5: 10239 Mb ORCL:OCRV3 | |
-------------------------------------------------------------------------------- | |
ORACLE_SID ORACLE_HOME | |
================================================================================ | |
+ASM /u01/app/grid/product/12.1.0/grid | |
[grid@em13c ~]$ sqlplus / as sysasm | |
SQL*Plus: Release 12.1.0.2.0 Production on Tue Jan 19 18:20:39 2016 | |
Copyright (c) 1982, 2014, Oracle. All rights reserved. | |
Connected to: | |
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production | |
With the Automatic Storage Management option | |
SYS@+ASM> col name for a20 | |
SYS@+ASM> col compatibility for a20 | |
SYS@+ASM> col database_compatibility for a20 | |
SYS@+ASM> select group_number, name, compatibility, database_compatibility | |
2 from v$asm_diskgroup; | |
GROUP_NUMBER NAME COMPATIBILITY DATABASE_COMPATIBILI | |
------------ -------------------- -------------------- -------------------- | |
1 OCRV 12.1.0.0.0 10.1.0.0.0 | |
SYS@+ASM> CREATE DISKGROUP DATA EXTERNAL REDUNDANCY | |
2 DISK 'ORCL:DATA1' | |
3 ATTRIBUTE 'au_size'='4M', | |
4 'compatible.asm' = '12.1.0.0.0', | |
5 'compatible.rdbms' = '12.1.0.0.0'; | |
Diskgroup created. | |
SYS@+ASM> CREATE DISKGROUP FRA EXTERNAL REDUNDANCY | |
2 DISK 'ORCL:FRA1' | |
3 ATTRIBUTE 'au_size'='4M', | |
4 'compatible.asm' = '12.1.0.0.0', | |
5 'compatible.rdbms' = '12.1.0.0.0'; | |
Diskgroup created. | |
SYS@+ASM> select group_number, name, compatibility, database_compatibility | |
2 from v$asm_diskgroup | |
3 order by group_number; | |
GROUP_NUMBER NAME COMPATIBILITY DATABASE_COMPATIBILI | |
------------ -------------------- -------------------- -------------------- | |
1 OCRV 12.1.0.0.0 10.1.0.0.0 | |
2 DATA 12.1.0.0.0 12.1.0.0.0 | |
3 FRA 12.1.0.0.0 12.1.0.0.0 | |
SYS@+ASM> @asm_diskgroups.sql | |
Disk Group Sector Block Allocation | |
Name Size Size Unit Size State Type Total Size (MB) Used Size (MB) Free Size (MB) Pct. Used Comp Compdb | |
------------------------- ------- ------- ------------ ----------- ------ --------------- -------------- -------------- --------- ------------ ------------ | |
DATA 4,096 4,096 4,194,304 MOUNTED EXTERN 51,196 84 51,112 .16 12.1.0.0.0 12.1.0.0.0 | |
FRA 4,096 4,096 4,194,304 MOUNTED EXTERN 76,796 84 76,712 .11 12.1.0.0.0 12.1.0.0.0 | |
OCRV 4,096 4,096 4,194,304 MOUNTED HIGH 30,708 288 30,420 .94 12.1.0.0.0 10.1.0.0.0 | |
--------------- -------------- -------------- | |
Grand Total: 158,700 456 158,244 | |
SYS@+ASM> @asm_disks.sql | |
Disk Group Name Path File Name Fail Group File Size (MB) Used Size (MB) Pct. Used | |
------------------------- -------------------- -------------------- -------------------- -------------- -------------- --------- | |
DATA ORCL:DATA1 DATA1 DATA1 51,196 84 .16 | |
************************* -------------- -------------- | |
51,196 84 | |
FRA ORCL:FRA1 FRA1 FRA1 76,796 84 .11 | |
************************* -------------- -------------- | |
76,796 84 | |
OCRV ORCL:OCRV1 OCRV1 OCRV1 10,236 96 .94 | |
ORCL:OCRV2 OCRV2 OCRV2 10,236 96 .94 | |
ORCL:OCRV3 OCRV3 OCRV3 10,236 96 .94 | |
************************* -------------- -------------- | |
30,708 288 | |
-------------- -------------- | |
Grand Total: 158,700 456 |
No comments:
Post a Comment