背景:对主备机的物理内存扩容一倍,内存扩容后,需要修改数据库相关的内存参数,包括数据库层面和操作系统层面。预计对备机扩容一倍内存操作完毕后,修改相关..
背景:
对主备机的物理内存扩容一倍,内存扩容后,需要修改数据库相关的内存参数,包括数据库层面和操作系统层面。预计对备机扩容一倍内存操作完毕后,修改相关内存参数,将数据库启动到备机,运行2天,若没有问题,再对之前的主机物理内存扩容一倍,将数据库切换到备机。之所以这么做,是因为扩容操作,需要关闭操作系统,一晚上搞不定,所以分两次操作,同时也可以更好的确保,主备机在内存扩容和修改相关数据库参数后,都可以正常运行。
环境介绍:
双机 操作系统:solaris 10 数据库版本:oracle 11g R1 64bit 当前主机的hostname和IP: fly-db1 192.168.20.20 当前备机的hostname和IP: fly-db2 192.168.20.21 物理内存,扩容前94G,扩容后188G1、确认数据库的内存管理方式:手动管理
SQL> show parameter memory_target NAME TYPE VALUE ------------------------------------ ----------- ------- memory_target big integer 0 SQL> show parameter sga_target NAME TYPE VALUE ------------------------------------ ----------- ------- sga_target big integer 02、查看当前spfile路径:采用共享存储
SQL>show parameter spfile 3、刚已确认数据库的参数文件采用共享存储,则数据库的所有文件(控制文件,在线日志,数据文件(数据表空间和临时表空间的数据文件),参数文件)均应该为裸设备,现需确认主备机数据库的这些文件确实为裸设备,以及权限均为:oracle:oinstall或者oracle:dba,以避免双机切换过程中,因为数据库的文件权限不正确或使用到文件系统的数据文件导致切换失败(之前遇到过这种情况,所以需要再次确认)bash-3.00$ hostname fly-db1 bash-3.00$ cat check_file.sql //在当前主机运行以下SQL,查询所有数据库文件,保存到文本oracle_131215.txt set heading off set echo off set newpage none set feedback off spool oracle_131215.txt select file_name from dba_data_files; select file_name from dba_temp_files; select member from v$logfile; select name from v$controlfile; select value from v$parameter where; spool off bash-3.00$ sqlplus /nolog SQL> conn /as sysdba Connected. SQL> @check_file.sql SQL> quit bash-3.00$ ls check_file.sql oracle_131215.txt bash-3.00$ for i in $(cat oracle_131215.txt);do ls -l $i;done //查看这些文件(有省略)是否为裸设备(即字符设备),权限是否正确 crw------- 1 oracle dba 342, 200 Dec 15 07:39 /dev/raw/raw1 crw------- 1 oracle dba 342, 201 Dec 15 02:57 /dev/raw/raw2 crw------- 1 oracle dba 342, 202 Dec 15 03:04 /dev/raw/raw3 crw------- 1 oracle dba 342, 254 Dec 15 01:22 /dev/raw/raw4 crw------- 1 oracle dba 342, 253 Dec 15 03:25 /dev/raw/raw5 bash-3.00$ for i in $(cat oracle_131215.txt);do ls -l $i | grep -v ^c;done //若文件个数太多,则刷选开头不是c打头的文件,若无输出,即均为裸设备 bash-3.00$ for i in $(cat oracle_131215.txt);do ls -l $i | grep root;done //刷选是否有root字眼的文件,文件创建时,默认为root:root bash-3.00$ scp oracle_131215.txt oracle@192.168.20.21:/home/oracle/ //在备机执行一样的操作 Password: oracle_131215.txt 100% |*********************************************************************************| 27216 00:00 bash-3.00$ ssh oracle@192.168.20.21 Password: Last login: Sun Dec 15 10:31:13 2013 from 192.168.20.20 ONLY Authorized users only! All accesses logged fly-db2% bash bash-3.00$ hostname fly-db2 bash-3.00$ for i in $(cat oracle_131215.txt);do ls -l $i;done crw------- 1 oracle dba 342, 200 Sep 15 2012 /dev/raw/raw1 crw------- 1 oracle dba 342, 201 Sep 15 2012 /dev/raw/raw2 crw------- 1 oracle dba 342, 202 Sep 15 2012 /dev/raw/raw3 crw------- 1 oracle dba 342, 254 Sep 15 2012 /dev/raw/raw4 crw------- 1 oracle dba 342, 253 Sep 15 2012 /dev/raw/raw5 bash-3.00$ for i in $(cat oracle_131215.txt);do ls -l $i | grep -v ^c;done bash-3.00$ for i in $(cat oracle_131215.txt);do ls -l $i | grep root;done4、确认需要修改的参数:
在主备机修改/etc/system文件中的以下参数为以下值,:(shmsys:shminfo_shmmax为共享内存段的最大值,一般为物理内存的一半,精确到字节) set shmsys:shminfo_shmmax=100931731456 将以下数据库参数修改为以下值: memory_max_target=110G //物理内存的60% sga_max_size=110G //物理内存的60% db_cache_size=55G //物理内存的30% shared_pool_size=10G //物理内存的5% pga_aggregate_target=18G //物理内存的10% db_files=2000 //数据库的数据文件个数限制修改为2000 processes=3000 //当前该值已经很大,不再修改具体的操作步骤如下:
1、主备机的/etc/system文件必须一致,否则将备机的shmsys:shminfo_shmmax参数修改后,重启备机操作系统生效该参数时,将失败,/etc/system文件只有在操作系统引导时,才会被读取,理论上,在数据库运行时,是可以修改/etc/system文件的shmsys:shminfo_shmmax参数的
2、修改主备机的/etc/system文件中的shmsys:shminfo_shmmax参数为物理内存(188G)的一半,精确到字节。
set shmsys:shminfo_shmmax=100931731456
3、对比主备机的/etc/system文件是否一致,无任何输出,则一致
bash-3.00#hostname fly-db1 bash-3.00# diff /etc/system /home/oracle/system_flydb2_131215.bak4、重启备机操作系统,生效该参数的设置
bash-3.00# hostname fly-db1 bash-3.00# sync bash-3.00# sync bash-3.00# sync bash-3.00# shutdown -i6 -g0 -y
MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The steps to build a MySQL database include: 1. Create a database and table, 2. Insert data, and 3. Conduct queries. First, use the CREATEDATABASE and CREATETABLE statements to create the database and table, then use the INSERTINTO statement to insert the data, and finally use the SELECT statement to query the data.

MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool