oracle怎么修改参数,oracle数据库配置参数修改
如何使用pfile文件 修改oracle数据库参数
pfile
目前成都创新互联公司已为近1000家的企业提供了网站建设、域名、虚拟空间、网站改版维护、企业网站设计、安阳县网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
静态
spfile动态
oracle10g版本
如果安装数据库软件时安装了数据库或是使用DBCA创建了数据库会默认生成spfile
pfile可以对spfile的备份,是文本格式的,容易修改参数,再生成spfile,spfile是二进制格式的不易修改。
这个参数是数据库启动必须的参数。如果手动创建数据库就需要使用这些参数,如果使用图形的软件创建就会自动生成
ORACLE中如何为存储过程传递参数?
第一种:只读。参数是只读的,不能修改,即调用时传递进来的是常量,或者变量(但变量不能在存储过程中修改)。通常select及DML类型的存储过程传递的是in类型的参数。
第二种:只写。忽略调用语句传递的任何参数,并在函数(过程)内部给这些参数赋值,因此是只写的。(这种情况是在函数或过程内部给参数重新赋值,但重新赋值后的参数是无法被外部调用的(好像游标类型的参数除外))
CREATE OR REPLACE PROCEDURE "SCOTT"."SWAP" (firstValue out
number, secondValue out number) is
temp number;
begin
temp := firstValue;
firstValue := secondValue;
secondValue := temp;
end swap;
外部调用:
set serveroutput on;
declare
firstVal number;
secondVal number;
begin
firstVal := 10;
secondVal := 20;
scott.swap(firstVal,secondVal);
dbms_output.put_line('first is ' || firstVal);
dbms_output.put_line('second is ' || secondVal);
end;
无法在外部访问到firstValue与secondValue的值。此时打印出的结果为:
first is
second is
第三种:读或写。这可以完全控制参数,读取传递的参数的值。可以再函数(过程)内部修改参数的值,在退出函数(过程)后,这些参数被赋给在函数内部写入的值,这样就可以返回多个值。(即入口参数写入值后,可以传递到函数(过程)的外部,供外部调用的时候使用)
ps:函数中的返回值为如下几种:
char; varchar2; number; integer; date; boolean; table; record
SQL CREATE OR REPLACE PROCEDURE HelloWorld2 (
2 p_user_name IN VARCHAR2,
3 p_out_val OUT VARCHAR2,
4 p_inout_val IN OUT VARCHAR2
5 ) AS
6 BEGIN
7 dbms_output.put_line('Hello ' || p_user_name || p_inout_val || '!');
8 p_out_val := 'A';
9 p_inout_val := 'B';
10 END HelloWorld2;
11 /
Procedure created.
SQL DECLARE
2 p_outval VARCHAR2(10);
3 p_inoutval VARCHAR2(10) := '~Hi~';
4 BEGIN
5 HelloWorld2('Edward', p_outval, p_inoutval);
6
7 dbms_output.put_line('p_outval=' || p_outval);
8 dbms_output.put_line('p_inoutval=' || p_inoutval);
9 END;
10 /
Hello Edward~Hi~!
p_outval=A
p_inoutval=B
PL/SQL procedure successfully completed.
oracle中怎么重建控制文件或是修改控制文件参数
环境:
OS:Red Hat Linux As 5
DB:10.2.0.4
在全部控制文件丢失或损坏,而且没有备份的情况下,可以使用重建控制文件的办法打开数据库.以下模拟所有的控制文件丢失的情况下重建控制文件.
1.备份控制文件(数据库mount或是open状态)
SQL select status from v$instance;
STATUS
------------
OPEN
SQLalter database backup controlfile to trace as '/u01/ftp/bak_controlfile';
2.删除控制文件
[oracle@hxl oracl]$ rm control01.ctl
rm: remove regular file `control01.ctl'? y
[oracle@hxl oracl]$ rm control02.ctl
rm: remove regular file `control02.ctl'? y
[oracle@hxl oracl]$ rm control03.ctl
rm: remove regular file `control03.ctl'? y
3.关闭数据库后尝试打开数据库
SQL shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL startup
ORACLE instance started.
Total System Global Area 734003200 bytes
Fixed Size 1221564 bytes
Variable Size 218106948 bytes
Database Buffers 511705088 bytes
Redo Buffers 2969600 bytes
ORA-00205: error in identifying control file, check alert log for more info
这个时候数据无法打开,以为我们已经删除了控制文件.
4.查看备份控制文件的内容
[oracle@hxl ftp]$ more bak_controlfile
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="oracl"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_10=ENABLE
--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
-- Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORACL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/oracl/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
-- Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORACL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/oracl/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
5.从备份控制文件中提取我们需要的部分,这里我们选择RESETLOGS,将如下内容保存文件为
create_confile.sql
CREATE CONTROLFILE REUSE DATABASE "ORACL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
6.执行create_confile.sql
SQLset sqlblanklines on -- 因为文件中有空行,需要将该选项打开,否则执行的时候报语法错误
SQL@/u01/ftp/create_confile.sql
SQL alter database open resetlogs;
Database altered.
说明:
重建控制文件后,若备份信息是存储在控制文件的,该信息会丢失.
如何修改oracle参数sessions
先备份spfile
1.通过SQLPlus修改
Oracle的sessions和processes的关系是
sessions=1.1*processes + 5
使用sys,以sysdba权限登录:
SQL show parameter processes;
NAME TYPE VALUE
------------------------------------ ----------- ---------------------------------------
aq_tm_processes integer 1
db_writer_processes integer 1
job_queue_processes integer 10
log_archive_max_processes integer 1
processes integer 150
SQL alter system set processes=400 scope = spfile;
系统已更改。
SQL show parameter processes;
NAME TYPE VALUE
------------------------------------ ----------- -----------------------------------------
aq_tm_processes integer 1
db_writer_processes integer 1
job_queue_processes integer 10
log_archive_max_processes integer 1
processes integer 150
SQL create pfile from spfile;
文件已创建。
重启数据库,OK!
【注:sessions是个派生值,由processes的值决定,公式sessions=1.1*process + 5】
2.通过修改oracle配置文件进行修改
修改SPFILEORCL.ORA文件中的processes的值。8.1.5中是init.ora文件,在9i中修改init.ora文件是无效的,这个文件由于是一个二进制的文件,不能直接使用notepad此类的编辑器打开。
否则会报错误ORA-27101 Shared memory realm does not exist。使用UltraEdit或者EditPlus之类的可以编辑二进制文件的编辑器打开此文件(直接编辑二进制文件),然后在Windows服务中重新启动Oracle服务器即可。
3.通过Oracle Enterprise Manager Console在图形化管理器中修改
a.以系统管理员的身份登入
b.进入数据库的例程-配置-一般信息-所有初始化参数
c.修改processes的值
d.Sessions的值由公式sessions=1.1*process + 5派生得到
各位大虾。。如何修改oracle的静态参数文件,烦请赐教??
你是用那种参数文件的呢。pfile?还是spfile?(用show
parameter
spfile
可以查看)
如果你是用spfile,在数据库open的状态下使用alter
system
set
parameter=value
scope=??
就可以更改了
如果你是使用pfile,修改$ORACLE_HOME/dbs/initSID.ora这个就可以了,用vim就可以改
还要注意你需要修改的参数是静态的还是动态的
分享题目:oracle怎么修改参数,oracle数据库配置参数修改
标题路径:http://cdiso.cn/article/hspejd.html