ALTER DATABASE SET COMPATIBILTY_LEVEL executes irrespective of IF EXIST condition
Hi,
Problem:
I want to set compatibility_level only when it is greater than 110.
Solution:
Select the compatibility level and if it is greater than 110, I alter database set compatibility level=110
ISSUE
Irrespective of IF Exist statement the alter database statement is executed all the time.
Here is the sql statement
IF EXISTS (
SELECT * FROM sys.databases where compatibility_level >110 AND name='mydatabase'
BEGIN
ALTER DATABASE mydatabase SET COMPATIBILITY_LEVEL = 110
END
What is that I am missing here ??
please support.
Hi Gokula,
Based on my tested, the syntax of your query is correct which you can see on the screenshots below.
When COMPATIBILITY_LEVEL is 120.
When COMPATIBILITY_LEVEL is 110.
So in your scenario, please check the current COMPATIBILITY_LEVEL.
Regards,
Charlie Liao
TechNet Community Support
Similar Messages
-
Alter database set TIME_ZONE error
I am following along in the first Sybex OCA book with Oracle 9i Personal Edition using version 9.2.0...(I believe 9.2.0.0.1?)
I am using the seed database that contains hr and various others...I got to the following command, but under the hr login, it says I do not have permission. So I tried logging in as system and it claims ORA-02231: missing or invalid option to ALTER DATABASE. The same occurs if I login under sys AS sysdba (or as sysoper) or if I login under system AS sysdba.
I tried the command (which I no longer remember) to export the init.oca settings (it created INITorcl.OCA or initORCL.oca) as one message indicated it might be the compatibility setting. However that was set to 9.2.0 and the message said it needed to be 9.1 or higher.
What am I doing wrong?
It is on P. 142, Chapter 3 (single-Row Fucntions) and the command is simple enough...
ALTER DATABASE SET TIME_ZONE='-06:00';
(and it should reply database altered)
I have also tried ALTER DATABASE SET TIME_ZONE='US/Central'; and many, many other variances. Ideally, after that succeds one should do a
SHUTDOWN
STARTUP
and then be able to SELECT DBTIMEZONE FROM dual; to get a dbtime of -06:00, but since it thinks my assignment is invalid, I cannot find a way to get it to accept it. Plz help. I have been searching extensively and trying numerous ideas. While I know it is of little importance now, I want to understand every aspect I can.
This is the book by Chip Dawes and Biju Thomas (OCA/OCP: Introduction to Oracle9i SQL Study Guide)
Thanks,
RossYou can only change the database timezone if you have no TIMESTAMP WITH LOCAL TIMEZONE columns in the database.
TSLTZ columns are stored normalized to the database timezone, that means that after changing the database timezone the interpretation of the data would be wrong.
ORDERS.ORDER_DATE in the demo schema OE is an TSLTZ column
If you remove this column you can change the database timezone. -
Standby database errors - Alter database open read only
alter database open read only
AUDIT_TRAIL initialization parameter is changed to OS, as DB is NOT compatible for database opened with read-only access
Signalling error 1152 for datafile 1!
Beginning standby crash recovery.
Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Media Recovery Waiting for thread 1 sequence 216
Mon Dec 20 11:58:18 2010
Standby crash recovery need archive log for thread 1 sequence 216 to continue.
Please verify that primary database is transporting redo logs to the standby database.
Wait timeout: thread 1 sequence 216
Standby crash recovery aborted due to error 16016.
Errors in file /u01/app/oracle/diag/rdbms/mdm2/MDM2/trace/MDM2_ora_17442.trc:
ORA-16016: archived log for thread 1 sequence# 216 unavailable
Recovery interrupted!
Completed standby crash recovery.
Signalling error 1152 for datafile 1!
Errors in file /u01/app/oracle/diag/rdbms/mdm2/MDM2/trace/MDM2_ora_17442.trc:
ORA-10458: standby database requires recovery
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+MDMDG1/mdm2/datafile/system.280.738243341'
ORA-10458 signalled during: alter database open read only...
Mon Dec 20 12:13:46 2010
ALTER DATABASE RECOVER managed standby database using current logfile disconnect
Attempt to start background Managed Standby Recovery process (MDM2)
Mon Dec 20 12:13:46 2010
MRP0 started with pid=23, OS id=18974
MRP0: Background Managed Standby Recovery process started (MDM2)
started logmerger process
Mon Dec 20 12:13:51 2010
Managed Standby Recovery starting Real Time Apply
Parallel Media Recovery started with 2 slaves
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Waiting for thread 1 sequence 216
Completed: ALTER DATABASE RECOVER managed standby database using current logfile disconnect
The above lines are from alert log of standby database.
Standby standbase
SQL> alter database open read only;
alter database open read only
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+MDMDG1/mdm2/datafile/system.280.738243341'
Parameters set on primary are
log_archive_dest_1 LOCATION=+MDMDG3/MDM1/ARCH VALID_FOR=(ALL_LOGFILES,ALL_ROLE ) DB_UNIQUE_NAME=MDM1
log_archive_dest_state_1 ENABLE
log_archive_dest_2 SERVICE=MDM2 SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MDM2
log_archive_dest_state_2 ENABLE
dg_broker_config_file1 +MDMDG2/mdm/dg_config/dgconfig1_mdm.dat
dg_broker_config_file2 +MDMDG2/mdm/dg_config/dgconfig2_mdm.dat
fal_server MDM2
standby_file_management AUTO
log_archive_config dg_config=(MDM1,MDM2)
db_file_name_convert MDM2, MDM1
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE availability ;
Standby pfile
*.archive_lag_target=900
*.audit_file_dest='/u01/app/oracle/admin/MDM2/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='+MDMDG1/MDM2/CONTROLFILE/controlfile01.ctl','+MDMDG2/MDM2/CONTROLFILE/controlfile02.ctl'
*.db_block_size=8192
*.db_create_file_dest='+MDMDG1'
*.db_domain=''
*.db_file_name_convert='MDM1','MDM2'
*.db_name='MDM'
*.db_recovery_file_dest='+MDMDG2'
*.db_recovery_file_dest_size=10485760000
*.db_unique_name='MDM2'
*.dg_broker_config_file1='+MDMDG2/MDM/DG_CONFIG/dgconfig1_MDM.dat'
*.dg_broker_config_file2='+MDMDG2/MDM/DG_CONFIG/dgconfig2_MDM.dat'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=MDM2XDB)'
*.fal_server='MDM11','MDM12'
*.instance_name='MDM2'
*.log_archive_config='dg_config=(MDM1,MDM2)'
*.log_archive_dest_1='LOCATION=+MDMDG3/MDM2/ARCH VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MDM2'
*.log_archive_dest_2='SERVICE=MDM1 ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MDM1'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='MDM_%t_%s_%r.arc'
*.log_file_name_convert='MDM1','MDM2'
*.memory_target=838860800
*.nls_language='ENGLISH'
*.nls_territory='UNITED KINGDOM'
*.open_cursors=300
*.processes=500
*.remote_login_passwordfile='exclusive'
*.sessions=555
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
On standby ASM
ASMCMD [+] > find * *
+MDMDG1/ASM/
+MDMDG1/ASM/ASMPARAMETERFILE/
+MDMDG1/ASM/ASMPARAMETERFILE/REGISTRY.253.737811541
+MDMDG1/MDM/
+MDMDG1/MDM2/
+MDMDG1/MDM2/CONTROLFILE/
+MDMDG1/MDM2/CONTROLFILE/controlfile01.ctl
+MDMDG1/MDM2/CONTROLFILE/current.265.738243333
+MDMDG1/MDM2/DATAFILE/
+MDMDG1/MDM2/DATAFILE/CANVAS_POPULARITY_DATA.264.738243343
+MDMDG1/MDM2/DATAFILE/CANVAS_POPULARITY_IDX.277.738243343
+MDMDG1/MDM2/DATAFILE/MDM_SRC_DATA.282.738243343
+MDMDG1/MDM2/DATAFILE/MDM_SRC_IDX.275.738243343
+MDMDG1/MDM2/DATAFILE/MIPS_MDM_DATA.283.738243341
+MDMDG1/MDM2/DATAFILE/MIPS_MDM_IDX.276.738243343
+MDMDG1/MDM2/DATAFILE/SYSAUX.281.738243341
+MDMDG1/MDM2/DATAFILE/SYSTEM.280.738243341
+MDMDG1/MDM2/DATAFILE/TEST_TBSP1.273.738243345
+MDMDG1/MDM2/DATAFILE/TEST_TBSP2.272.738243345
+MDMDG1/MDM2/DATAFILE/UNDOTBS1.256.738243343
+MDMDG1/MDM2/DATAFILE/UNDOTBS2.279.738243343
+MDMDG1/MDM2/DATAFILE/USERS.278.738243347
+MDMDG1/MDM2/ONLINELOG/
+MDMDG1/MDM2/ONLINELOG/group_1.259.738243429
+MDMDG1/MDM2/ONLINELOG/group_2.257.738243431
+MDMDG1/MDM2/ONLINELOG/group_21.284.738243505
+MDMDG1/MDM2/ONLINELOG/group_22.261.738243505
+MDMDG1/MDM2/ONLINELOG/group_23.274.738243505
+MDMDG1/MDM2/ONLINELOG/group_3.258.738243431
+MDMDG1/MDM2/ONLINELOG/group_31.262.738243513
+MDMDG1/MDM2/ONLINELOG/group_32.270.738243513
+MDMDG1/MDM2/ONLINELOG/group_33.263.738243513
+MDMDG1/MDM2/ONLINELOG/group_4.260.738243431
+MDMDG2/MDM/
+MDMDG2/MDM/DG_CONFIG/
+MDMDG2/MDM2/
+MDMDG2/MDM2/AUTOBACKUP/
+MDMDG2/MDM2/AUTOBACKUP/2010_12_20/
+MDMDG2/MDM2/AUTOBACKUP/2010_12_20/s_738242861.263.738244155
+MDMDG2/MDM2/CONTROLFILE/
+MDMDG2/MDM2/CONTROLFILE/controlfile02.ctl
+MDMDG2/MDM2/CONTROLFILE/current.271.738243335
+MDMDG2/MDM2/ONLINELOG/
+MDMDG2/MDM2/ONLINELOG/group_1.270.738243429
+MDMDG2/MDM2/ONLINELOG/group_2.269.738243431
+MDMDG2/MDM2/ONLINELOG/group_21.268.738243505
+MDMDG2/MDM2/ONLINELOG/group_22.272.738243505
+MDMDG2/MDM2/ONLINELOG/group_23.262.738243505
+MDMDG2/MDM2/ONLINELOG/group_3.273.738243431
+MDMDG2/MDM2/ONLINELOG/group_31.266.738243513
+MDMDG2/MDM2/ONLINELOG/group_32.265.738243513
+MDMDG2/MDM2/ONLINELOG/group_33.264.738243513
+MDMDG2/MDM2/ONLINELOG/group_4.261.738243431
+MDMDG3/MDM/
+MDMDG3/MDM/ARCH/
+MDMDG3/MDM2/
+MDMDG3/MDM2/ARCH/
-- Please can I know how to open read only standby database.user5846399 wrote:
ORA-16016: archived log for thread 1 sequence# 216 unavailable
Recovery interrupted!archived log for thread 1 sequence# 216
This file is needed for recovery, Find it and move it to the standby database side. -
Execute sql command "ALTER SESSION SET..."
How can i execute command "ALTER SESSION SET NLS_DATE_FORMAT ='MM/DD/YYYY'" with JDBC
api.
And by default?
Bye
SteI'm not sure that you want to do this in Java. I would imagine that the NLS_DATE_FORMAT would be set by the Oracle DBA, and shouldn't be changed by a Java app via JDBC.
Besides, when you query the database for a date it's returned as a java.sql.Date, regardless of the settings in the database. Once you have that, you can format it according to your wishes by using java.text.DateFormat and java.text.SimpleDateFormat.
I thought the point was that the JDBC driver took care of ensuring that you got java.sql.Date objects back from queries, regardless of the NSL_DATE_FORMAT setting in the database. -
"Alter system set command" in a RAC database!!
Hi, all.
The database is (10.2.0.2.0) 2- node RAC database on 32-bit windows 2003
EE SP1.
I issued the following command on Node 1 database.
--> Alter system set db_block_buffers= xxx sid='rac1';
I was able to see "PE enqueue" in top 5 wait event section from an AWR report.
In addition, I was able to find "PZ99","PZ98" process dump file in BDUMP.
Soon later, I could find CKPT and DBWR hung.
Is there anyone who experienced this issue?
Thanks and Regards.
Message was edited by:
user50729010.2.0.2 has some bug which is fixed 10.2.0.3
You check sequence cache. If it has less value, increase it to 10000.
select CACHE_SIZE from dba_sequences where SEQUENCE_OWNER='SYS' and SEQUENCE_NAME='AUDSES$';
SQL> alter sequence sys.audses$ cache 10000;
Ashok -
How to alter database character set from AL32UTF8 to EE8MSWIN1250
Hi folks,
I'm using an Oracle 10g, XE database, which has a database character set set to AL32UTF8, what causes that some characters like "č ť ř ..." are not displayed.
To fix this issue, I would like to change it to EE8MSWIN1250 character set as it's set on server.
Unfortunatelly below steps don;t work for me:
connect sys as sysdba;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE NATIONAL CHARACTER SET EE8MSWIN1250;
ALTER DATABASE CHARACTER SET EE8MSWIN1250;
SHUTDOWN IMMEDIATE; -- or SHUTDOWN NORMAL;
STARTUP;Value in regedit: HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_XE is set to CZECH_CZECH REPUBLIC.EE8MSWIN1250
I'm struggling with this issue for hours and unfortunatelly can't make it work. Any advise is more than welcome.
Thanks,
Tomas
I tried to use hints listed here , but always getting some ORA messages.Hi Sergiusz,
Thank you for your reply. You're right, I've probably didn't provide a full details about my issue, but at least now I know, that database encoding(characterset) is correct.
Here is my issue:
Within my APEX application I would like to use a JasperReportsIntegration, so to be able to create and run iReports straight from APEX application. Installation, and implementation of JasperReports works fine, I had no issue with it.
As a second step I've created a simple report using iReport tool, when if preview function is used, all static characters (from report labels) are displayed correctly. Database items are displayed incorectly - some Czech characters are not displayed. Language within report is set to cs_CS, but I've tried also other options. No sucess.
When I run that report from APEX application (from server) then the same issue - data from database are returned without some czech characters.
Kind regards,
Tomas -
Execute immediate 'alter session set current_schema = ' failed in PL/SQL
Hi
I am trying to run
EXECUTE IMMEDIATE 'ALTER SESSION SET CURRENT_SCHEMA = TEST ' ;
in a pl/sql block but it is failing.Can anyone update me on this.
CREATE OR REPLACE PROCEDURE test3
IS
A_COUNT NUMBER(15);
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET CURRENT_SCHEMA = TEST ' ;
SELECT COUNT(*) INTO A_COUNT FROM (
select id from solutions );
END;
/The user who owns the procedure needs to be granted direct select rights on table test.solutions (not via a role). Still will not help. Look what OP is trying to do. In a stored procedure owned by some user (other than TEST) OP is trying to reference user TEST owned table solution without prefixing it with owner. Something like:
SQL> create table u1.test_tbl(x number);
Table created.
SQL> select * from test_tbl;
select * from test_tbl
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> alter session set current_schema = U1;
Session altered.
SQL> select * from test_tbl;
no rows selected
SQL> However, OP tries to do it in a SP using dynamic SQL to change current schema to test. Such change will occur when SP will be executed, not when is it compiled. At compile time we are still under SP owner's schema and therefore select from solutions implies table solutions owned by SP owner, not by TEST. The only way to make SP compile and work OK is to select from solutions also dynamically:
SQL> select sys_context('userenv','current_schema') from dual
2 /
SYS_CONTEXT('USERENV','CURRENT_SCHEMA')
SCOTT
SQL> CREATE OR REPLACE PROCEDURE test3
2 IS
3 A_COUNT NUMBER(15);
4 BEGIN
5 EXECUTE IMMEDIATE 'ALTER SESSION SET CURRENT_SCHEMA = U1' ;
6 SELECT COUNT(*) INTO A_COUNT FROM (
7 select x from test_tbl );
8 END;
9 /
Warning: Procedure created with compilation errors.
SQL> sho err
Errors for PROCEDURE TEST3:
LINE/COL ERROR
6/1 PL/SQL: SQL Statement ignored
7/15 PL/SQL: ORA-00942: table or view does not exist
SQL> set serveroutput on
SQL> CREATE OR REPLACE PROCEDURE test3
2 IS
3 A_COUNT NUMBER(15);
4 c sys_refcursor;
5 BEGIN
6 EXECUTE IMMEDIATE 'ALTER SESSION SET CURRENT_SCHEMA = U1' ;
7 OPEN C FOR 'SELECT COUNT(*) FROM (select x from test_tbl )';
8 FETCH c INTO A_COUNT;
9 dbms_output.put_line(a_count);
10 CLOSE c;
11 END;
12 /
Procedure created.
SQL> insert into u1.test_tbl select rownum from emp;
14 rows created.
SQL> exec test3
14
PL/SQL procedure successfully completed.
SQL> Obviously, as you noted SP owner must have directly granted select on test3.solutions.
SY. -
i'm trying to change the character set of my oracle 8.1.6 database from USANSCII to UTF8,using the alter database command.
ALTER DATABASE CHARACTER SET UTF8;
But the error being thrown is "New charset needs to be a superset of the old charset.
Can i migrate from ANSCI TO UTF8 on Oracle 8i?What do you get when you query your database using the following SQL statement?
SQL> SELECT * FROM V$NLS_PARAMETERS
2 WHERE PARAMETER LIKE '%CHARACTERSET';
PARAMETER VALUE
NLS_CHARACTERSET WE8ISO8859P15
NLS_NCHAR_CHARACTERSET AL16UTF16 -
hi,
i programme a procedure which include some requirements that
should execute the command like ' alter session set
NLS_DATE_FORMAT='YYYYMMDD' '.
but the sqlplus error is
PLS-00103: Encountered the symbol "ALTER" when expecting one of
the following:
begin declare end exit for goto if loop mod null pragma
raise
return select update while <an identifier>
<a double-quoted delimited-identifier> <a bind
variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall
<a single-quoted SQL string>
The symbol "update was inserted before "ALTER" to
continue.
help me please.you can set that parameter in 2 ways from stored procedures.
1) execute immediate 'alter session...'
remember, Oracle gives commit while executing above command.
2) use dbms_session.set_nls procedure.
dbms_session.set_nls('nls_date_format','mm/dd/yyyy');
Suresh Vemulapalli -
Alter database statement in anonymous pl/sql block
Is it possible to include an alter database statement in an anonymous pl/sql block?
When I execute this code to query user_tables for all table names, disable their constraints and drop the table, I got the following error:
***MY CODE
-- DECLARE VARIABLE(S)
DECLARE
v_TABLE_NAME TABLE_NAME.USER_TABLE%TYPE;
-- DECLARE AND DEFINE CURSOR
CURSOR c_GETTABLES is
SELECT TABLE_NAME from USER_TABLES;
BEGIN
OPEN c_GETTABLES;
LOOP
FETCH c_GETTABLES into v_TABLE_NAME;
EXIT when c_GETTABLES%notfound;
ALTER TABLE v_TABLE_NAME DISABLE PRIMARY KEY CASCADE;
DROP TABLE v_TABLE_NAME;
END LOOP;
CLOSE c_GETTABLES;
END;
***RESPONSE FROM SERVER
ALTER TABLE v_TABLE_NAME DISABLE PRIMARY KEY CASCADE;
ERROR at line 15:
ORA-06550: line 15, column 1:
PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge
<a single-quoted SQL string> pipe
ThanksWhen you want to perform ddl statements in a (anonymous) PL/SQL block, you have to use dynamic SQL because ddl is not possible in pl/sql.
Dynamic sql means that you sort of execute ddl statements in a sql manner. To use dynamic sql, two options exist:
- dbms_sql package : for oracle before 8i. To use this package is not always easy. Read about it carefully first before using.
- Native Dynamic SQL : implemented in 8i and very easy to use. An example would be :
declare
lv_statement varchar2(32676);
begin
lv_statement := 'ALTER TABLE MY_TABLE DISABLE CONSTRAINT MY_TABLE_CK1';
execute immediate lv_statement;
lv_statement := 'ALTER TABLE MY_TABLE ENABLE CONSTRAINT MY_TABLE_CK1';
execute immediate lv_statement;
end;
Good luck.
Edwin van Hattem -
ORA-279 signalled during: ALTER DATABASE RECOVER automatic standby databas
Hi,
oracle server:8.1.7.0.0
os:solaris 5.9
we created standby server by taking coldbackup of primary server and we are using rsync to syschronize the archive log files between production and standby servers but every over we recover the standby server by executing
sql>recover automatic standby database:
but in alert log file i am getting the following error :
but when i googled for ora-279 error some people says it is default behaviour and can it be ignored and why it is asking next logfile.
Media Recovery Log /oratranslog/arch_1_1701118.arc
Wed Mar 26 21:35:34 2008
Media Recovery Log /oratranslog/arch_1_1701119.arc
Wed Mar 26 21:35:54 2008
Media Recovery Log /oratranslog/arch_1_1701120.arc
ORA-279 signalled during: ALTER DATABASE RECOVER automatic standby database...
Wed Mar 26 21:36:24 2008
ALTER DATABASE RECOVER CANCEL
Wed Mar 26 21:36:24 2008
Media Recovery Cancelled
Completed: ALTER DATABASE RECOVER CANCEL
Thanks and Regards
Prakash
juniour oracle dbadamorgan,
He is running 8.1.7.0. "DataGuard" scripts were initially available for 9i and then
backported (and available as a seperate download) for 8i. Many 8i implementations
did not and do not use DataGuard.
Even if it is "Jurassic" {which it certainly is NOT}, they obviously do have a good
reason for setting up a standby -- they DO have data of value. So, maybe they have
not upgraded to 9i or 10g. There could be a dozen reasons
1. Server HW/OS doesn't support 9i/10g, not budgetting for Server upgrade
2. Application using Forms 2.x or 4.5 and not tested on 9i / 10g (4.5 not certified
on 9i)
3. Low end client PCs working perfectly with Character-mode forms, not powerful
enought to run Jinitiator and Forms 6i / 9i
Just because someone hasn't upgraded to 10g doesn't mean that they are at fault
when you do NOT know the reason why they have not upgraded.
Surely, they do know that 8i is desupported. Don't you think that their management
has undertaken due diligence / cost-benefit analysis in considering whether they
should upgrade to 10g ?
Maybe they have another project implementing 10g in parallel and will be able
to shutdown this environment soon. Maybe they don't need to do so.
Do understand that people are intelligent enough to make their own decisions
considering their particular circumstances and don't go shooting off with your
assumption that anyone not running 10g is a dinosaur. -
Hi,
I was under impression that
"PFILE has the limitation to change the initialization parameters dynamically.If any init parameter is to be changed,we can edit the pfile and the parameter changes will come into effect with the next reboot of the system.
To overcome this limitation,Oracle has come up with the concept of SPFILE ,where in the initialization parameters can be changed dynamically using ALTER SYSTEM SET statement."
But,today I started my test database using PFILE and executed the following command to change the memory_target parameter from 300M to 290M.
ALTER SYSTEM SET memory_target=290M;
And to my surprise,this statement executed fine without any errors and memory_target parameter has been set to the new value(of course,in memory).
Isn't it changing the init parameters dynamically using PFILE itself??
Please clarify my doubt and correct my understanding.
Regards,
BharathbharathDBA wrote:
Hi,
I was under impression that
"PFILE has the limitation to change the initialization parameters dynamically.If any init parameter is to be changed,we can edit the pfile and the parameter changes will come into effect with the next reboot of the system.
To overcome this limitation,Oracle has come up with the concept of SPFILE ,where in the initialization parameters can be changed dynamically using ALTER SYSTEM SET statement."
But,today I started my test database using PFILE and executed the following command to change the memory_target parameter from 300M to 290M.
ALTER SYSTEM SET memory_target=290M;
And to my surprise,this statement executed fine without any errors and memory_target parameter has been set to the new value(of course,in memory).
Isn't it changing the init parameters dynamically using PFILE itself??
Please clarify my doubt and correct my understanding.
Regards,
Bharath
You have a wrong interpenetration about the genesis of the SPFILE. Yes it is a binary file and all that but remember, its not the SPFILE that makes a parameter dynamic or a PFILE that makes it static but it's the very nature of the parameter itself that makes it happen. Yes, the difference in the PFILE and SPFILE parameter would be evident when you would change a dynamic parameter and would give a bounce to the db. Since teh PFILE wasn't updated (its a text file so has to be updated manually) , with the next restart, the parameter would take the same value as it has in the PFILE. But with the SPFILE, depending on what you have set in the SCOPE, the parameter would behave accordingly.
HTH
Aman.... -
Using SQL Server 2012 SP1
I have a user that is submitting a procedure that uses sp_send_dbmail. I have also noticed that they have the following code in their procedure
DECLARE @rc INT
IF NOT EXISTS (SELECT * FROM msdb.sys.service_queues
WHERE name = N'ExternalMailQueue' AND is_receive_enabled = 1)
EXEC @rc = msdb.dbo.sysmail_start_sp
The user submits the procedure and she gets the email but she also gets the following error message:
Msg 15151, Level 16, State 1, Procedure sysmail_start_sp, Line 8
Cannot alter the queue 'ExternalMailQueue', because it does not exist or you do not have permission.
Mail (Id: 2402) queued.
(1 row(s) affected)
I have granted execute to sp_send_dbmail and sysmail_start_sp. I have also granted select to service_queues.
Does anyone have any solutions for the above error message?
lcerniThe contents of sysmail_start_sp is this:
CREATE PROCEDURE sysmail_start_sp
AS
SET NOCOUNT ON
DECLARE @rc INT
DECLARE @localmessage nvarchar(255)
ALTER QUEUE ExternalMailQueue WITH STATUS = ON
SELECT @rc = @@ERROR
IF(@rc = 0)
BEGIN
ALTER QUEUE ExternalMailQueue WITH ACTIVATION (STATUS = ON);
SET @localmessage = FORMATMESSAGE(14639, SUSER_SNAME())
exec msdb.dbo.sysmail_logmailevent_sp @event_type=1, @description=@localmessage
END
RETURN @rc
The user get the error, because she does not have any permission on the queue in question. To be able to alter the queue, the following applies according to Books Online:
Permission for altering a queue defaults to the owner of the queue, members of the db_ddladmin or db_owner fixed database roles, and members of the sysadmin fixed server role.
Note that is would be db_ddladmin or db_owner in msdb. Now, supposedly the queue is already active, and in that case I think that it is sufficient that the user has VIEW DEFINITION on the view. This would permit her to see the row in sys.service_queues,
why there would be no need to call sysmail_start_sp.
Altertanively, change the check to:
DECLARE @isenabled bit
SELECT @isenabled = (SELECT is_receive_enabled FROM msdb.sys.service_queues
WHERE name = N'ExternalMailQueue')
IF @isenabled = 0
EXEC @rc = msdb.dbo.sysmail_start_sp
The idea here is that, if the user has no permission to read the information in the DMV, @isenabled will be NULL, and you just pray and hope that the queue is up and running.
I suspect that the reason this worked for you on SQL 2005 is that on that instance someone at some point in made all the required configurations for it to work, but all that is forgotten now. That happens to me too.
If you really want the user to be able to start the queue, I have some better ideas than adding her to a role, but I skip the details for now.
Erland Sommarskog, SQL Server MVP, [email protected] -
"Alter Database" command in Database Standby
Hi community.
I have the following situation:
I've ASE 15.7 CE SP121 in two enviroments: System Production and System Standby. The Standby is maintained with load of dump transaction generated in production every 10 minutes.
Now I need increase a database in data portion in 100GB. I know that I must make this in each enviroment (Production and Standby), also I know that I can execute alter database command while the database in the System Standby is offline.
The process that I make is:
Stop dump transaction in production.
Stop Load transaction in Standby.
Alter database "on" in Production. Result is Sucessfull.
Alter database "on" in Standby. Result is error:
In this step, I receipt the following error:
The database DBUSER is in the middle of a load sequence. Altering it will not let you load other transaction dumps in the dump-set. If you still prefer to do it please use OVERRIDE option.
In this situation I have that put online database and increase the size. Obiously, I can't load more dump transaction and I should generate a full dump database in production, load this dump in standby and load dump transations after to load of dump database (full).
I simulate my situation in a enviorement of test with pubs3 and then of load the last dump transaction, I can do alter database in my DB standby without problems and after of this process I continue load dump transaction.
I don't understand why receipt this error?
Any recomendation?
Thanks!
Cristian Lopez.I can't recall trying to extend an offline database so what I'd probably do (short of waiting for a definitive answer from someone @ SAP/Sybase ... either here in the forum or from tech support) ...
1 - Assuming you have to perform a full database dump/load after issuing 'alter database', decide on a good time to perform the full database dump/load and then ...
2 - follow your steps (above) and then try restarting the log dump/load and ...
3a - if the log dump/load succeeds ... you've got nothing else to do
3b - if the log dump/load fails, then proceed with the full database dump/load -
ALTER DATABASE/MODIFY FILE issue
Greetings to all --
We are running SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64), and running into what seems like a bug. One of the largest tables was moved to a separate file group a while ago, and now a large percentage of the rows from that table (about 50GB) , need to
be removed.
We wanted to reduce the amount of transaction log growth and the duration required for the delete. Recovery model was set to BULK_LOGGED before executing the following steps:
1. create a new filegroup
2. create a new file in that filegroup
3. set the new filegroup to be the DEFAULT filegroup
4. SELECT INTO new_table from original_table WHERE filter_condition
5. drop original_table
6. rename new_table to original_table
7. remove original file from original filegroup
8. remove original filegroup
9. MODIFY the logical name of the new file to be the same as the logical name of the original logical name.
ALTER DATABASE myDB
MODIFY FILE ( NAME = new_logicalname, NEWNAME = original_logicalname)
This fails:
Msg 1828, Level 16, State 3, Line 1
The logical file name "original_logicalname" is already in use. Choose a different name.
I noticed that the original filegroup still persisted until I did a transaction log backup, but after that , there is no entry for that file in sys.databasefiles for that database.
Checking sp_helpdb for that database shows only the new logical file name.
Any thoughts would be much appreciated.This scenario is easily reproduced, and seems not to be "by design".
I put my bets on Sean and say "by design".
I can't put my finger on it, but it has to with doing restores, and particularly log restores. It does not seem to happen with a database in simple recovery. But for a database in full (or bulk_logged) recovery, there lingers a row in sysfiles1 and sysprufiles
for the dropped file.
sys.database_files is a view over sys.sysprufiles and it does not display the deleted file, but it is there with a certain status.
In any case, I can't see that this is the end of the world. It is not likely that you refer to the name of that fill all around the house. But the next time you do this manouvre, you may want to rename the existing file before you drop it and create
the new one.
Erland Sommarskog, SQL Server MVP, [email protected]
Maybe you are looking for
-
Can not open View Entire Inbox from Inbox Preview
I use comcast for e mail. I get to Inbox Preview, but it will not go to View Entire Inbox. Will work on IE.
-
Sub-line of credit in case of facilities
Hi, I have created various lines of credit in TCL1 such as 1.Funded 2.Non-Funded, etc I created a facility using 56B. At the structure tab, there is an option 'Other lines'. Here, I want to have the Prim.line of credit as the Main line of credit and
-
Have I received a new iPad from the distributor? How can I unlock the iPad?
-
Hello , After upgrade , we have observed that there are junk characteristics in field PLZU-PLNNR ( Key for Task List Group) Could someone explain the contents of table PLZU & what are the dependencies of PLZU with other PL* tables
-
Shift key only working on some letters ?!?
Ok - this just started ... I can get capitals by using cap-lock on all keys. Please help - obviously this is pretty annoying. with the regular shift it works as below. letters in upper case work with both shift keys letters in lower case work with ne