In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail what the ASM commands are, and the editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
I. ASM management login / startup / shutdown
1. Start and shut down an ASM instance
[oracle@node2 dbs] $export ORACLE_SID=+ASM2 [oracle@node2 dbs] $sqlplus / as sysdbaSQL > startupSQL > shutdown immediate
two。 Check the SQL of disk group information
SQL > SELECT STATE, REDUNDANCY, TOTAL_MB, FREE_MB, NAME, FAILGROUP FROM vastly disconnected STATE > SELECT GROUP_NUMBER, NAME, STATE, TYPE, TOTAL_MB, FREE_MB, UNBALANCED FROM v$asm_diskgroup
3. Create a new diskgroup
SQL > create diskgroup dgtest normal redundancy failgroup DATA1 disk'/ dev/oracleasm/VOL5' name DATA1 failgroup DATA2 disk'/ dev/oracleasm/VOL6' name DATA2
4. Delete diskgroup
SQL > drop diskgroup DATA including contents;-for multi-node diskgroup, it can only be dorp after it is mounted on one asm instance, and other nodes must be dismount.
5. Manual mount command
ALTER DISKGROUP ALL DISMOUNT; ALTER DISKGROUP ALL MOUNT; ALTER DISKGROUP DATA DISMOUNT; ALTER DISKGROUP DATA MOUNT
6. Add disk to diskgroup
SQL > alter diskgroup DATA add disk'/ dev/oracleasm/VOL5' name VOL5,'/ dev/oracleasm/VOL6' name VOL6
7. Remove disk from diskgroup
SQL > alter diskgroup DATA drop disk VOL5
8. Canceling the command to delete disk can only be valid when the above command is not completed.
ALTER DISKGROUP DATA UNDROP DISKS
II. Management of data files
1. Create an alias using the fully qualified filename.
ALTER DISKGROUP disk_group_1 ADD ALIAS'+ disk_group_1/my_dir/my_file.dbf' FOR'+ disk_group_1/mydb/datafile/my_ts.342.3'
2. Create an alias using the numeric form filename.
ALTER DISKGROUP disk_group_1 ADD ALIAS'+ disk_group_1/my_dir/my_file.dbf' FOR'+ disk_group_1.342.3'
3. Rename an alias.
ALTER DISKGROUP disk_group_1 RENAME ALIAS'+ disk_group_1/my_dir/my_file.dbf' TO'+ disk_group_1/my_dir/my_file2.dbf'
4. Delete an alias.
ALTER DISKGROUP disk_group_1 DELETE ALIAS'+ disk_group_1/my_dir/my_file.dbf'
5. Drop file using an alias.
ALTER DISKGROUP disk_group_1 DROP FILE'+ disk_group_1/my_dir/my_file.dbf'
6. Drop file using a numeric form filename.
ALTER DISKGROUP disk_group_1 DROP FILE'+ disk_group_1.342.3'
7. Drop file using a fully qualified filename.
ALTER DISKGROUP disk_group_1 DROP FILE'+ disk_group_1/mydb/datafile/my_ts.342.3'
8. Create datafile
SQL > create tablespace users2 datafile'+ TESTDB_DATA1' size 100m
four。 ASMCMD tool
For the management of ASM instances, in addition to sqlplus, Oracle also provides asmcmd commands. For more information, please see help.
1. View the location of asm bin
[oracle@node1 bin] $which asmcmd
/ u01/app/oracle/product/10.2.0/db_1/bin/asmcmd
two。 Switch to asmcmd mode
[oracle@node1 bin] $cd / u01/app/oracle/product/10.2.0/db_1/bin/
[oracle@node1 bin] $. / asmcmd
3. Specific asm command
Cd:-- enter the lower directory or enter the required directory du:-- display all the disk space occupied by ASM files in the specified ASM directory find:-- find the required files help:-- display help information ls:-- list the contents of the ASM directory and their attributes lsct:-- list the information of the current ASM client lsdg:-- list all disk groups and their attributes mkalias :-- create an alias for the system-generated file name mkdir:-- create a new directory pwd:-- display the current directory path rm:-- delete a file or folder under the ASM directory rmalias:-- delete alias
V. matters needing attention
1. After the ASM instance is configured and the ASM disk group is created, you must also ensure that it has been registered in Listener before it can be used in the database instance, otherwise you need to register the ASM instance manually:
SQL > alter system register
two。 Once the database instance uses ASM as storage, it is not possible to shut down the ASM instance while the database instance is running. Otherwise it will be reported to ORA-15097:cannot SHUTDOWN ASM instance with connected RDBMS instance. Mistake.
3. Delete ASM instance from Oracle
Delete automatic Storage Management instance + ASM instance + ASM deletion is done after the database is uninstalled and all files in the / ORACLE_HOME/dbs directory (except those related to ASM) are deleted.
Therefore, the following steps must be completed:
4.1 from the command prompt, set the oracle_sid environment variable to + ASM instance:
# export oracle_sid=+ASM
4.2 launch SQL*Plus and connect to the automatic Storage Management + ASM instance as a sys user:
# sqlplus / as sysdba
4.3 use the following command to determine if a database instance is using the automatic storage management instance + ASM:
SQL > select instance_name from v$asm_client
The result of this command lists all database instances that are running and using the + ASM instance. You cannot delete a + ASM instance as long as it contains a database instance that is being supported.
(in fact, you can first shutdown the corresponding database instance, then enter the directory where the disk group resides from asmcmd, and delete the corresponding database directory and files.)
4.4 if there is no database instance associated with + ASM, delete the disk group associated with that instance.
First, identify the disk group associated with + ASM:
SQL > select name from v$asm_diskgroup
Second, delete each disk group you want to delete with the following command:
SQL > drop diskgroupincluding contents
4.5 close the + ASM instance and exit SQL*Plus:
SQL > shutdown
SQL > exit
4.6 enter the following command at the command prompt to remove the + ASM service (I couldn't find the command, so I didn't run it):
Oradim-delete-asmsid + ASM
This is the end of this article on "what are the ASM commands?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.