oracle管理笔记1
1. 后台进程 dbwr 数据库写进程。lgwr 日志写进程。ckpt 检查点写进程。smon 系统监控进程。 pmon进程监控进程。 arch归档进程。 reco 恢复进程。 lckn 封锁进程。 2.DBA命令执行方式 sqldba mode=line 或 sqldba lmode=y 然后 SQLDBA 输入行命令 3.oracle
1. 后台进程
dbwr 数据库写进程。lgwr 日志写进程。ckpt 检查点写进程。smon 系统监控进程。 pmon进程监控进程。
arch归档进程。 reco 恢复进程。 lckn 封锁进程。
2.DBA命令执行方式
sqldba mode=line 或 sqldba lmode=y 然后 SQLDBA> 输入行命令
3.oracle 特殊用户:
(1)internal: 只能在服务器端使用的超级用户,它具有DBA的所有特权。4.
(2)system(manager):显示管理信息的视图,和oracle工具所使用的所以视图。
(3)sys(change_on_install) 只能在服务器端使用的超级用户。
4.启动数据库
(1)启动参数和约束条件
Exclusive/Parallel:专用/并行数据库模式。
Database Name:要启动的数据库名,默认值为ORACLE_SID变量的值。
Parameter File:在启动实例时,访问的参数文件名,默认文件为initSID.ora。Force:在启动实例前,强行关闭当前实例。
Restrict to DBAs:数据库启动后,只有DBA特权的用户才能访问数据库。
Recover:在启动实例时,用日志文件做数据库恢复(2)用行命令启动数据库:
sqldba mode=line
sqldab>connect internal
sqldba>startup
5.关闭方式
(1)Normal 处理完用户提交的所有事务,等带用户退出连接后,关闭数据库、卸载数据库、关闭实例。在下次启动实例时,不做实例恢复操作。
(2)Immediate/ Abort Instance结束正在处理的SQL语句、回滚未提交事务、不等待用户退出正常连接。在下次启动实例时,做实例恢复操作rmal处理完用户提交的
所有事务,等待用户退出连接后,关闭数据库、卸载数据库、关闭实例。在下次启动实例时,不做实例恢复操作。
(3)用命令行关闭数据库 sqldba mode=line sqldba>connect internal sqldba>shutdown
6.用户管理:
(1)添加用户:
CREATE USER 用户名 INDENTIFIED BY 口令
EXTERNALLY
DEFAULT TABLESPACE 表空间名
TEMPORARY TABLESPACE 表空间名
QUOTA 整数 K/M ON 表空间名
UNLIMITED
PROFILE 环境文件名例:
CREATE USER sidney INDENTIFIED BY carton
DEFAULT TABLESPACE cases_ts
TEMPORARY TABLESPACE temp_ts
QUOTA 5M ON cases_ts
QUOTA 5M ON temp_ts
PROFILE engineer
建立按操作系统帐号george可存取的用户。
CREATE USER OPS$georage
INDENTIFIED EXTERNALLY
DEFAULT TABLESPACE accs_ts
TEMPORARY TABLESPACE temp_ts
QUOTA UNLIMITED ON accs_ts
QUOTA UNLIMITED ON temp_ts(2)删除用户:
DROP USER 用户名 CASCADE
(3)与用户管理有关的数据字典视图
?USER_USERS
? ALL_USERS
? DBA_USERS
? USER_TS_QUOTAS
6.环境文件管理
?Sessions/User:限制一个用户的并发会话个数。
?CPU Time/Session :限制一次会话的CPU时间,单位:百分之一秒。
?CPU Time/Call:限制一次调用(一次语法分析、执行或获得)的CPU时间,单位:百分之一秒。
?Connect Time:限制一会话总的使用时间,单位:分。
?Logical Reads/Session:限制在一次会话中读的数据块的数目,包括从内存或磁盘读的块数。
?Logical Reads/Call:限制处理一个SQL语句(语法分析、执行和获取)一次调用所读的数据块的数目。
?Private SGA/Session:限制一次会话在SGA的共享池可分配的专用空间的数目,单位:bytes/Kbytes/Mbytes。
? Composite Limit:一次会话总的资源开销,以服务单位表示该参数的值。
删除环境文件
DROP PROFILE环境文件名CASCADE

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

An AWR report is a report that displays database performance and activity snapshots. The interpretation steps include: identifying the date and time of the activity snapshot. View an overview of activities and resource consumption. Analyze session activities to find session types, resource consumption, and waiting events. Find potential performance bottlenecks such as slow SQL statements, resource contention, and I/O issues. View waiting events, identify and resolve them for performance. Analyze latch and memory usage patterns to identify memory issues that are causing performance issues.

Triggers in Oracle are stored procedures used to automatically perform operations after a specific event (insert, update, or delete). They are used in a variety of scenarios, including data verification, auditing, and data maintenance. When creating a trigger, you need to specify the trigger name, association table, trigger event, and trigger time. There are two types of triggers: the BEFORE trigger is fired before the operation, and the AFTER trigger is fired after the operation. For example, the BEFORE INSERT trigger ensures that the age column of the inserted row is not negative.
