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,
Ross
You 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.
Similar Messages
-
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 -
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. -
Alter database open resetlogs upgrade ; throwing error
Recently i have cloned a database from 11.2.0.2 to 11.2.0.3 on a new server.... I got the error as fowwos,
contents of Memory Script:
Alter clone database open resetlogs;
executing Memory Script
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00601: fatal error in recovery manager
RMAN-03004: fatal error during execution of command
RMAN-10041: Could not re-create polling channel context following failure.
RMAN-10024: error setting up for rpc polling
RMAN-10005: error opening cursor
RMAN-10002: ORACLE error: ORA-03114: not connected to ORACLE
RMAN-03002: failure of Duplicate Db command at 07/12/2012 16:19:24
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 29247
Session ID: 200 Serial number: 5
So i have tried
SQL> alter database open resetlogs upgrade;
alter database open resetlogs upgrade
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery
SQL> alter database open upgrade;
alter database open upgrade
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '+DATA_CMX/cmx/datafile/system.270.788451975'
Any help ?Hi,
Duplicate is not supported using different version of database, so I recommend you don't use duplicate.
Because RMAN "duplicate" attempts to automatically rename (rename required recover) and open the database you may not use RMAN duplicate for this case, only RMAN restore.
Perform this work using normal restore database.
See this example.
On prod database with db_name/db_unique_name dbupg:
Recovery Manager: Release 11.2.0.2.0 - Production on Fri Jul 13 15:15:59 2012
RMAN> backup database plus archivelog delete input;
Starting backup at 13-JUL-12
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=52 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=17 RECID=1 STAMP=788540852
input archived log thread=1 sequence=18 RECID=2 STAMP=788541371
channel ORA_DISK_1: starting piece 1 at 13-JUL-12
channel ORA_DISK_1: finished piece 1 at 13-JUL-12
piece handle=/u01/app/oracle/flash_recovery_area01/DBUPG/backupset/2012_07_13/o1_mf_annnn_TAG20120713T151612_800shf7w_.bkp tag=TAG20120713T151612 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area01/DBUPG/archivelog/2012_07_13/o1_mf_1_17_800rz40y_.arc RECID=1 STAMP=788540852
archived log file name=/u01/app/oracle/flash_recovery_area01/DBUPG/archivelog/2012_07_13/o1_mf_1_18_800shcsd_.arc RECID=2 STAMP=788541371
Finished backup at 13-JUL-12
Starting backup at 13-JUL-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DS8000_DG/dbupg/datafile/system.271.788537119
input datafile file number=00002 name=+DS8000_DG/dbupg/datafile/sysaux.272.788537167
input datafile file number=00003 name=+DS8000_DG/dbupg/datafile/undotbs1.273.788537199
input datafile file number=00004 name=+DS8000_DG/dbupg/datafile/users.275.788537229
channel ORA_DISK_1: starting piece 1 at 13-JUL-12
channel ORA_DISK_1: finished piece 1 at 13-JUL-12
piece handle=/u01/app/oracle/flash_recovery_area01/DBUPG/backupset/2012_07_13/o1_mf_nnndf_TAG20120713T151614_800shgw5_.bkp tag=TAG20120713T151614 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 13-JUL-12
channel ORA_DISK_1: finished piece 1 at 13-JUL-12
piece handle=/u01/app/oracle/flash_recovery_area01/DBUPG/backupset/2012_07_13/o1_mf_ncsnf_TAG20120713T151614_800sjm29_.bkp tag=TAG20120713T151614 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-JUL-12
Starting backup at 13-JUL-12
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=19 RECID=3 STAMP=788541412
channel ORA_DISK_1: starting piece 1 at 13-JUL-12
channel ORA_DISK_1: finished piece 1 at 13-JUL-12
piece handle=/u01/app/oracle/flash_recovery_area01/DBUPG/backupset/2012_07_13/o1_mf_annnn_TAG20120713T151652_800sjnf7_.bkp tag=TAG20120713T151652 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/flash_recovery_area01/DBUPG/archivelog/2012_07_13/o1_mf_1_19_800sjn5q_.arc RECID=3 STAMP=788541412
Finished backup at 13-JUL-12
RMAN> backup current controlfile;
Starting backup at 13-JUL-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 13-JUL-12
channel ORA_DISK_1: finished piece 1 at 13-JUL-12
piece handle=/u01/app/oracle/flash_recovery_area01/DBUPG/backupset/2012_07_13/o1_mf_ncnnf_TAG20120713T153435_800tkwl2_.bkp tag=TAG20120713T153435 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-JUL-12I used same server to do this work... I really dont recommend that, if yes you must be aware about location of restore... you should use new server:
Create a spfile:
*.control_files='+DS8000_DG/dbclone/controlfile/Current.277.788541913'
*.db_name='dbupg'
*.db_unique_name='dbclone'
*.audit_file_dest='/u01/app/oracle/admin/dbclone/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.db_block_size=8192
*.db_create_file_dest='+MMC'
*.db_domain=''
*.db_recovery_file_dest_size=107374182400
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area01'
*.diagnostic_dest='/u01/app/oracle'
*.log_file_name_convert='+DS8000_DG','+MMC'
*.memory_target=1031798784
*.open_cursors=300Make backup available on new server:
and:
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jul 13 15:33:24 2012
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1027182592 bytes
Fixed Size 2227936 bytes
Variable Size 599785760 bytes
Database Buffers 419430400 bytes
Redo Buffers 5738496 bytes
SQL> show parameter db_n
NAME TYPE VALUE
db_name string dbupg
SQL> show parameter db_un
NAME TYPE VALUE
db_unique_name string dbclone
RMAN> restore controlfile from '/u01/app/oracle/flash_recovery_area01/DBUPG/backupset/2012_07_13/o1_mf_ncnnf_TAG20120713T153435_800tkwl2_.bkp';
Starting restore at 13-JUL-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=290 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output file name=+DS8000_DG/dbclone/controlfile/current.277.788541913
Finished restore at 13-JUL-12
RMAN> startup mount
database is already started
database mounted
released channel: ORA_DISK_1
RMAN> run {
2> SET NEWNAME FOR DATABASE TO '+MMC';
3> restore database ;
4> }
executing command: SET NEWNAME
Starting restore at 13-JUL-12
Starting implicit crosscheck backup at 13-JUL-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=290 device type=DISK
Crosschecked 4 objects
Finished implicit crosscheck backup at 13-JUL-12
Starting implicit crosscheck copy at 13-JUL-12
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 13-JUL-12
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +MMC
channel ORA_DISK_1: restoring datafile 00002 to +MMC
channel ORA_DISK_1: restoring datafile 00003 to +MMC
channel ORA_DISK_1: restoring datafile 00004 to +MMC
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area01/DBUPG/backupset/2012_07_13/o1_mf_nnndf_TAG20120713T151614_800shgw5_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area01/DBUPG/backupset/2012_07_13/o1_mf_nnndf_TAG20120713T151614_800shgw5_.bkp tag=TAG20120713T151614
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
Finished restore at 13-JUL-12
RMAN> recover database;
Starting recover at 13-JUL-12
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 13-JUL-12So, just startup with upgrade option.
SQL*Plus: Release 11.2.0.3.0 Production on Fri Jul 13 15:39:31 2012
SQL> alter database open resetlogs upgrade; Now you can upgrade your database.
After upgrade database you can change the database name using NID:
$ nid
DBNEWID: Release 11.2.0.3.0 - Production on Fri Jul 13 15:50:23 2012
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Keyword Description (Default)
TARGET Username/Password (NONE)
DBNAME New database name (NONE)
LOGFILE Output Log (NONE)
REVERT Revert failed change NO
SETNAME Set a new database name only NO
APPEND Append to output log NO
HELP Displays these messages NOHTH,
Levi Pereira
Edited by: Levi Pereira on Jul 13, 2012 4:04 PM -
Alter database begin backup; missing keyword error
Hi all,
I am trying to put my database in backup mode using the command "alter database begin backup", but it is giving error shown below:
$ sqlplus '/as sysdba'
SQL*Plus: Release 9.2.0.5.0 - Production on Wed Nov 25 16:52:58 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
N05PCS07 READ WRITE
SQL> alter database begin backup;
alter database begin backup
ERROR at line 1:
ORA-00905: missing keyword
NE one can tell why the command is failing??
pls...
Thanks in advance.
SHAILESHHello,
All the former posts are right, alter database begin backup; doesn't exists in 9.2 althought
you already have in this release the alter database end backup;.
So as to put all the tablespaces in backup mode in one command I suggest you to create a
stored procedure as follows:
CREATE OR REPLACE PROCEDURE begin_backup IS
TYPE RefCurTyp IS REF CURSOR;
cv RefCurTyp;
sql_cv VARCHAR2(400);
tbs VARCHAR2(128);
sql_stmt VARCHAR2(200);
BEGIN
-- Mise en BEGIN BACKUP des TABLESPACES
sql_cv := 'SELECT distinct (A.name) FROM sys.v_$tablespace A, sys.v_$datafile B, sys.v_$backup C where A.TS# = B.TS# and B.FILE# = C.FILE# and C.STATUS = ''NOT ACTIVE''';
OPEN cv FOR sql_cv;
LOOP
FETCH cv INTO tbs;
EXIT WHEN cv%NOTFOUND;
sql_stmt := 'ALTER TABLESPACE '||tbs||' BEGIN BACKUP';
EXECUTE IMMEDIATE sql_stmt;
END LOOP;
CLOSE cv;
END;
Then, I just have to call the Procedure like that:
execute <schema>.begin_backup; and all the tablespaces are in backup mode.
This procedure must be created on a User/Schema with the following privileges:
alter tablespace
select on sys.v_$tablespace
select on sys.v_$datafile
select on sys.v_$backupHope it can help.
Best regards,
Jean-Valentin
Edited by: Lubiez Jean-Valentin on Nov 25, 2009 9:44 PM -
ORA-02231 error when issue ALTER DATABASE FORCE LOGGING
Hi,
Does everybody know why I faced ORA-02231 when issue below command in oracle,
SQL> ALTER DATABASE FORCE LOGGING;
ALTER DATABASE FORCE LOGGING
ERROR at line 1:
ORA-02231: missing or invalid option to ALTER DATABASE
SQL> ALTER DATABASE FORCE LOGGING ;
ALTER DATABASE FORCE LOGGING
ERROR at line 1:
ORA-02231: missing or invalid option to ALTER DATABASE
SQL> ALTER DATABASE FORCE LOGGING
2
SQL> ALTER TABLESPACE BIIS FORCE LOGGING
2 ;
ALTER TABLESPACE BIIS FORCE LOGGING
ERROR at line 1:
ORA-02142: missing or invalid ALTER TABLESPACE option
I use this oracle version:
Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
PL/SQL Release 9.0.1.1.1 - Production
CORE 9.0.1.1.1 Production
TNS for 32-bit Windows: Version 9.0.1.1.0 - Production
NLSRTL Version 9.0.1.1.1 - Production
Thanks.Hi Jaffar,
After I checked that you are correct.
I can issue the command without problem in oracle 9i Rel.2.
Thanks for your information.
Tarman. -
Cannot open database Control file error
I am new to Oracle db and while trying to multiplex the control files something went wrong. Now i am not able to open the db and it is in mount state.
when i try to startup force the database i get the following errors:
SQL> startup force
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 1250356 bytes
Variable Size 260049868 bytes
Database Buffers 331350016 bytes
Redo Buffers 7135232 bytes
Database mounted.
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\SREE\SYSTEM01
ORA-01207: file is more recent than control file - old control file
The database is in noarchivelog mode and i dont have any backup of it :(.
As the data is not critical i dont want to recove the data, i just want to bring my Database to Open state! Is it possible??
Thanks
Sreehi
you can create new controlfile
Creating a Controlfile: Example
This statement re-creates a control file. In this statement, database demo was created with the WE8MSWIN1252 character set. The example uses the word path where you would normally insert the path on your system to the appropriate Oracle Database directories.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORABASE" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'C:\APP\ORACLE\ORADATA\ORABASE\REDO01.LOG' SIZE 50M,
GROUP 2 'C:\APP\ORACLE\ORADATA\ORABASE\REDO02.LOG' SIZE 50M,
GROUP 3 'C:\APP\ORACLE\ORADATA\ORABASE\REDO03.LOG' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'C:\APP\ORACLE\ORADATA\ORABASE\SYSTEM01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\SYSAUX01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\UNDOTBS01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\USERS01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\EXAMPLE01.DBF',
'C:\APP\ORACLE\ORADATA\ORABASE\UWDATA01.DBF'
CHARACTER SET WE8MSWIN1252;
-- 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 'C:\APP\ORACLE\FLASH_RECOVERY_AREA\ORABASE\ARCHIVELOG\2009_02_02\O1_MF_1_1_%U_.ARC';
-- ALTER DATABASE REGISTER LOGFILE 'C:\APP\ORACLE\FLASH_RECOVERY_AREA\ORABASE\ARCHIVELOG\2009_02_02\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
-- 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 'C:\APP\ORACLE\ORADATA\ORABASE\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
http://psoug.org/reference/control_file.html
http://www.comp.dit.ie/btierney/oracle11gdoc/server.111/b28286/statements_5003.htm
hope this helps
zekeriya -
I go the error message when I open databse.
SQL> alter database open resetlogs;
alter database open resetlogs
ERROR at line 1:
ORA-01190: controlfile or data file 1 is from before the last RESETLOGS
ORA-01110: data file 1: '/u01/oracle/uatdata/system01.dbf'
Then I issue the following command:
SQL> recover datafile 1;
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done
what went wrong?
FANHere are the following information:
RMAN> list backup of controlfile
2> ;
using target database controlfile instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
402 Full 6M DISK 00:00:00 08-OCT-08
BP Key: 402 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081008-00
Controlfile Included: Ckp SCN: 2023488262 Ckp time: 08-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
412 Full 6M DISK 00:00:01 09-OCT-08
BP Key: 412 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081009-00
Controlfile Included: Ckp SCN: 2024136961 Ckp time: 09-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
422 Full 6M DISK 00:00:00 11-OCT-08
BP Key: 422 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081011-00
Controlfile Included: Ckp SCN: 2025471910 Ckp time: 11-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
425 Full 6M DISK 00:00:01 11-OCT-08
BP Key: 425 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081011-01
Controlfile Included: Ckp SCN: 2025471911 Ckp time: 11-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
435 Full 6M DISK 00:00:00 12-OCT-08
BP Key: 435 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081012-00
Controlfile Included: Ckp SCN: 2026183392 Ckp time: 12-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
436 Full 6M DISK 00:00:00 12-OCT-08
BP Key: 436 Status: AVAILABLE Tag: TAG20081012T111913
Piece Name: /u02/db/backup/RMAN/backup_UAT_667912753_460_1_ecjsv2hh_1_1.bck
Controlfile Included: Ckp SCN: 2026183392 Ckp time: 12-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
438 Full 6M DISK 00:00:00 12-OCT-08
BP Key: 438 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081012-01
Controlfile Included: Ckp SCN: 2026183393 Ckp time: 12-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
448 Full 6M DISK 00:00:00 12-OCT-08
BP Key: 448 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081012-02
Controlfile Included: Ckp SCN: 2026451642 Ckp time: 12-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
449 Full 6M DISK 00:00:00 12-OCT-08
BP Key: 449 Status: AVAILABLE Tag: TAG20081012T202618
Piece Name: /u02/db/backup/RMAN/backup_UAT_667945578_473_1_epjt02ja_1_1.bck
Controlfile Included: Ckp SCN: 2026451642 Ckp time: 12-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
451 Full 6M DISK 00:00:01 12-OCT-08
BP Key: 451 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081012-03
Controlfile Included: Ckp SCN: 2026451643 Ckp time: 12-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
461 Full 6M DISK 00:00:04 13-OCT-08
BP Key: 461 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081013-00
Controlfile Included: Ckp SCN: 2026889745 Ckp time: 13-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
464 Full 6M DISK 00:00:00 13-OCT-08
BP Key: 464 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081013-01
Controlfile Included: Ckp SCN: 2026889749 Ckp time: 13-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
474 Full 6M DISK 00:00:00 14-OCT-08
BP Key: 474 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081014-00
Controlfile Included: Ckp SCN: 2027589079 Ckp time: 14-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
477 Full 6M DISK 00:00:01 14-OCT-08
BP Key: 477 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081014-01
Controlfile Included: Ckp SCN: 2027589080 Ckp time: 14-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
487 Full 6M DISK 00:00:01 15-OCT-08
BP Key: 487 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081015-00
Controlfile Included: Ckp SCN: 2028248959 Ckp time: 15-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
488 Full 6M DISK 00:00:00 15-OCT-08
BP Key: 488 Status: AVAILABLE Tag: TAG20081015T111406
Piece Name: /u02/db/backup/RMAN/backup_UAT_668171647_512_1_g0jt6vbv_1_1.bck
Controlfile Included: Ckp SCN: 2028248959 Ckp time: 15-OCT-08
BS Key Type LV Size Device Type Elapsed Time Completion Time
490 Full 6M DISK 00:00:00 15-OCT-08
BP Key: 490 Status: AVAILABLE Tag:
Piece Name: /u02/oracle/uat/uatdb/9.2.0/dbs/c-1357907388-20081015-01
Controlfile Included: Ckp SCN: 2028248960 Ckp time: 15-OCT-08
FAN -
Errors in alert log and listener log and "alter database mount exclusive"
Hello!
I need a help.
Database 11R2 works under MS Windows Server.
Whwn I start it using Services, according alert log it is started by command "alter database mount exclusive".
Next - alter database open.
After this, it seams that program, which should put data into database, can not work with it, because I see errors in alert log: ora-12537, 12560, 12535, 12570, 12547.
What does itmean and what to do?
This is extract from alert_log
ORACLE_BASE from environment = C:\Oracle
Mon Feb 04 14:54:53 2013
alter database mount exclusive
Successful mount of redo thread 1, with mount id 1458539517
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: alter database mount exclusive
alter database open
Thread 1 opened at log sequence 3105
Current log# 3 seq# 3105 mem# 0: C:\ORACLE\ORADATA\xxx\REDO03.LOG
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
SMON: enabling cache recovery
Successfully onlined Undo Tablespace 2.
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
Database Characterset is AL32UTF8
No Resource Manager plan active
Mon Feb 04 14:55:04 2013
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Mon Feb 04 14:55:06 2013
QMNC started with pid=20, OS id=2860
Completed: alter database open
Mon Feb 04 14:55:11 2013
Starting background process CJQ0
Mon Feb 04 14:55:11 2013
CJQ0 started with pid=25, OS id=2000
Mon Feb 04 14:55:11 2013
db_recovery_file_dest_size of 4977 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Mon Feb 04 15:00:29 2013
Starting background process SMCO
Mon Feb 04 15:00:29 2013
SMCO started with pid=32, OS id=3212
Edited by: kogotok1 on Feb 4, 2013 4:54 PMThank you.
But in the same time - when I see in alert log those error messages ora -12560, 12537,12535,12570 and so on - clients programs, whiie try to connect, hang up.
For sql plus takes 20 minutes to connect.
lsnrctl status gives the following
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 04-FEB-2013 16:01
:46
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx-BD.mosxxx
.elektra.net)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Produ
ction
Start Date 01-FEB-2013 10:22:48
Uptime 3 days 5 hr. 39 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\Oracle\listener.ora
Listener Log File c:\oracle\diag\tnslsnr\xxx-BD\listener\alert\l
og.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx-BD.mosxxx.elektra.net)
(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XXX" has 2 instance(s).
Instance "XXX", status UNKNOWN, has 1 handler(s) for this service...
Instance "xxx", status READY, has 1 handler(s) for this service...
Service "XXXDB" has 1 instance(s).
Instance "xxx", status READY, has 1 handler(s) for this service...
The command completed successfully
To tell the truth I am confuse - I thought I have only 1 service "XXXDB" and 1 instance - "xxx".
May be I have wrong entries in tnslsnr.ora? -
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 -
"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 -
RMAN-10006: error running SQL statement: alter session set remote_dependenc
Backups are failing with following error
RMAN-00554: initialization of internal recovery manager package failed
RMAN-12001: could not open channel default
RMAN-10008: could not create channel context
RMAN-10002: ORACLE error: ORA-00096: invalid value SIGNATURE for parameter remote_dependencies_mode, must be from among MANUAL, AUTO
RMAN-10006: error running SQL statement: alter session set remote_dependencies_mode = signature
Not able to change to signature
SQL> alter session set remote_dependencies_mode=signature;
ERROR:
ORA-00096: invalid value SIGNATURE for parameter remote_dependencies_mode, must
be from among MANUAL, AUTO
I dont see MANUAL or AUTO as valid value for this parameter (http://download.oracle.com/docs/cd/B10501_01/server.920/a96536/ch1175.htm#1023124) DB version is 9.2.0
Parameter type
String
Syntax
REMOTE_DEPENDENCIES_MODE = {TIMESTAMP | SIGNATURE}
Default value
TIMESTAMP
Parameter class
Dynamic: ALTER SESSION, ALTER SYSTEM
=======================================
I believe it could be because of following bug
"A PRE-PATCHED ORACLE IMAGE CAN BE INSTALLED IN MEMORY "
Refer: "https://metalink2.oracle.com/metalink/plsql/f?p=130:15:1613505143885559758::::p15_database_id,p15_docid,p15_show_header,p15_show_help,p15_black_frame,p15_font:BUG,4610411,1,1,1,helvetica"
I appreciate your effort in fixing this issue.
Edited by: user10610722 on Nov 25, 2008 4:37 PMHi:
It seems when you are starting RMAN it's executing some commands (one 'ALTER SESSION...'. It's seems to be a batch which has a bad value for SORT_AREA_SIZE. Find it and modify to a proper value as message shows. If you can't find start RMAN by calling directly the executable ($ORACLE_HOME/bin/rman or %ORACLE_HOME%/bin/rman.exe). -
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 -
Startup command starts database but alter database open read only gives error
Hi,
I'm having some strange behavior. I've 10.2.0.3 database on windows 2003.
The startup command starts database without any issues.
But if I try following it gives error.
startup mount (successful no errors)
alter database open read only; gives error that file Mnnnnnn is missing.
Why this is happening and how to fix it?
Thanks.You really need to show us exactly what Oracle is telling you, using copy and paste, so we can have some clue. You can hide details like instance and host names if they show up.
I'm wondering if you had some messed up offline datafile in a tablespace, where Oracle handles it with startup, but gets upset when you try to open read-only. It's some bizarro sequence of events like: add a datafile to a tablespace, decide that was a mistake, alter it offline, then remove it from the OS without telling Oracle any more about it. I've come back from vacation to find scenarios like this, it winds up being a time-bomb trying to recreate a standby later. Or something like that, I could be unremembering some details. -
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
Maybe you are looking for
-
Mail crashes while trying to view Gmail inbox
Hi! After adding a gmail account my Mail keeps crashing every time I'm trying to go to it's Inbox. The strangest thing - I can read mail from another folders of this account. Moreover, my another Gmail account was previously added to Mail and works f
-
Sync : Changes in phone do not appear in Lotus Not...
Hi everyone, I've been fighting with my N73, PC suite and Lotus Note 6.5 for quite some time with this problem... When I sync, it doesn't synch from my phone to my computer although the option for cross sync is checked in the options ! When I sync an
-
How much is a 2nd gen 8gb iPod touch going for?
I am looking to sell it but I am having a hard time finding accurate pricings for it. Everything works fine with it and it has no scratches.
-
Robohelp 9 on Windows 7 64-bit: "Word not installed"
Windows 7 64-bit Robohelp 9 Word 2010 I did check the forum for this discussion (in 2011) which suggested approaching Adobe for a file to fix the problem. Adobe Support states that there is a long waiting line for support responses so i am posting in
-
Hello, I'm facing problems with the webutil_file package The copy_file function works ok. The rename_file and delete_file do not work. They return false. Any suggestions? Regards Erik