Unable to alter Oracle Parameters - oracle

I am unable to add more than 200 datafiles in my database because of these parameters:
select records_total from v$controlfile_record_section where type = 'DATAFILE';
select value from v$parameter where name = 'db_files';
Both of these give me an output of 200. I need to increase this to 400 so I have tried:
alter system set records_total = 400 where name = 'db_files';
alter system set value= 400 where type = 'DATAFILE';
but I am getting
S
QL Error: ORA-02065: illegal option for ALTER SYSTEM
02065. 00000 - "illegal option for ALTER SYSTEM"
*Cause: The option specified for ALTER SYSTEM is not supported
*Action: refer to the user manual for option supported
Am I able to change these parameters and how?

You probably want to use commands like this:
C:\Users\jonearles>sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Fri Jul 10 13:07:16 2015
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> show parameter db_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_files integer 200
SQL> alter system set db_files=400 scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1048576000 bytes
Fixed Size 3053584 bytes
Variable Size 662702064 bytes
Database Buffers 377487360 bytes
Redo Buffers 5332992 bytes
Database mounted.
Database opened.
SQL> show parameter db_files
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_files integer 400
SQL>
This assumes you are using an SPFILE (or else you will need to manually edit the init.ora file and restart) and you are not using RAC (or else you will need to use a command like srvctl stop database -d my_sid).
As ditto mentioned, it can help to look at the ALTER syntax. It may also help to look at the Oracle Database Reference, which will tell you if the command is dynamic (meaning it can be run without restarting the database).

Related

Turn on heat_map parameter in Oracle 12c

I have switched off heat_map parameter
SQL> SHOW PARAMETER heat_map;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
heat_map string OFF
But if I try to make it available I get the following errors:
SQL> ALTER SYSTEM SET heat_map = ON;
ALTER SYSTEM SET heat_map = ON
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00439: feature not enabled: Heat Map
What should I do to enable that parameter?
When you are shown ORA-00439, you cannot use the specified feature, as it is not enabled.
The first thing to check is to ensure that you are using Oracle Enterprise Edition.
According to Oracle features - standard edition vs. enterprise edition the new heat_map 12c feature is reserved only for users using EE.

Oracle XE audit_trail not saving for all users

I enabled auditing on my Oracle XE server via the following run by the sys user:
SQL> ALTER SYSTEM SET audit_sys_operations=true SCOPE=spfile;
SQL> ALTER SYSTEM SET audit_trail=XML,EXTENDED SCOPE=spfile;
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP
When I run queries as the sys user, an xml file records the queries in the default location (e.g., /u01/app/oracle/admin/XE/adump/xe_ora_2339_1.xml). However, if I run a query as a different user (e.g., test_user), no updates occur in any of the files in the adump directory.
I've confirmed that the parameter is set for the test_user:
SQL> show parameter audit;
NAME TYPE VALUE
------------------------ ------- ------------------------------
audit_file_dest string /u01/app/oracle/admin/XE/adump
audit_sys_operations boolean TRUE
audit_syslog_level string
audit_trail string XML, EXTENDED
I also tried restarting my sqlplus session (i.e., reconnecting with the test_user), as well as disabling audit_sys_operations, and the issue remains.
Version info: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production (via this docker image).
My issue was that, in addition to enabling auditing, I also needed to specify what to audit with the AUDIT command. In my case, I wanted everything, so I added the following (commands mentioned in this tutorial):
SQL> AUDIT ALL; # note: it seems like the next two statements would be included with "all", but I didn't verify this.
SQL> AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE;
SQL> AUDIT EXECUTE PROCEDURE;
Note that with AUDIT_TRAIL=XML,EXTENDED (and maybe all the file-based auditing settings?), it looks there is some buffering of writing the XML file, as I didn't get a query showing up until my test user disconnected, so if you are missing a log entry, try logging the user out to see if it shows up.

Inserting vietnamese characterset into nvarchar2/varchar without Prefix 'N' from client

I am having a database(Oracle 11g) on windows whose NLS_CHARACTERSET value is WE8MSWIN1252, while the NLS_NCHAR_CHARACTERSET value is AL16UTF16.
Now, I have a table 'TEST_NOTE' whose column type is NVARCHAR2. While running the following insert statement:
insert into test_note values (n'Chào thế giới!')
The data gets inserted fine and I am able to fetch it properly.
Since I have to insert the data from a different client software(company's proprietary software), I am not able to append 'n' to the value the user enters.
Also, can I make do with VARCHAR2 instead of NVARCHAR, as I don't want to change the existing schema of the database in production?
My ideal solution will be using VARCHAR2 and inserting Vietnamese Characters without using 'n' as prefix.
EDIT:
I Tried the following on Windows 10:
C:\WINDOWS\system32>chcp
Active code page: 437
C:\WINDOWS\system32>set NLS_LANG =.AL32UTF8
C:\WINDOWS\system32>sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 22 11:15:11 2017
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> connect system as sysdba
Enter password:
Connected.
SQL> insert into ss_repo.test_note values ('abcs','Chào thế giới!');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from SS_REPO.TEST_NOTE;
SOEID NOTE
-------------------- --------------------
ID17836 Chào th? gi?i!
s Chào th? gi?i!
abcs Chào th? gi?i!
ABCD Chαo th┐ gi┐i!
Or Can I do the same from SQL Developer? Will it be easy using that?
The client which will be used in production will be using JDBC JAR file OJDBC6.JAR
But for the time being I am trying to do using SQL Plus or SQL Developer.
Codepage 437 does not support any Vietnamese characters.
When you set set NLS_LANG =.AL32UTF8 then you have to execute chcp 65001 beforehand in order to change your codepage (and thus also character set of SQL*Plus) to UTF-8
However, using UTF-8 on Windows command line has some issues, see this discussion: https://community.oracle.com/thread/600575
You can also try Codepage 1258 which should work for Vietnamese:
C:\>chcp 1258
Active code page: 1258
C:\>set NLS_LANG =.VN8MSWIN1258
C:\>sqlplus ...

Oracle 12c extended to support varchar2 > 4000 bytes doesn't work for user who is not sysdba

On oracle 12c compatible 12.0.0, changed to extended with sysdba privileges.
I can create a table with varchar2(16000) as column now and insert a string > 4000 bytes; but only when connected as sysdba.
When connected as a normal user rather than sysdba, I cannot play with varchar2 >4000 bytes, an error ORA-60019 is thrown. Can anyone explain why?
the param max_string_size= extended and compatible=12.0.0 when logged in as a user who is not a sysdba.
Do following steps and let me know if the issue is resolved. I am asking to set the parameter again just to make sure
everything is in order.
1) Back up your spfile ( get location of spfile)
sqlplus / as sysdba
show parameter spfile;
2) Shut down the database.
sqlplus / as sysdba
shutdown immediate
3) Restart the database in UPGRADE mode.
startup upgrade
4) Change the setting of MAX_STRING_SIZE to EXTENDED.
alter system set MAX_STRING_SIZE ='EXTENDED' scope=spfile;
5)
sqlplus / as sysdba
#%ORACLE_HOME%\RDBMS\ADMIN\utl32k.sql
#%ORACLE_HOME%\RDBMS\ADMIN\utlrp.sql
Note: The utl32k.sql script increases the maximum size of the
VARCHAR2, NVARCHAR2, and RAW columns for the views where this is
required. The script does not increase the maximum size of the
VARCHAR2, NVARCHAR2, and RAW columns in some views because of the way
the SQL for those views is written.
rdbms/admin/utlrp.sql script helps to recompile invalid objects. You
must be connected AS SYSDBA to run the script.
6) Restart the database in NORMAL mode.
sqlplus / as sysdba
shutdown immediate
startup;
show parameter MAX_STRING_SIZE;
7) create new table with column datatype varchar2 having more than 4000 size.
You must change your file "TNSNAMES.ORA" to connect by PDB.
I was with the same problem.
I have solved with the information of link bellow.
https://dba.stackexchange.com/questions/240761/in-oracle-12c-tryiyng-to-create-table-with-columns-greater-than-4000
The reason for that behaviour is that you are in a multi-tenant environment, i.e. a master container called the CDB ("Container Database"), and any number of PDBs ("Pluggable Databases").
The CDB ("container") is a kind of "system" database that is there to contain the actual customer databases ("pluggable databases" or PDBs). The CDB is not intended to receive any customer data whatsoever. Everything goes into one or more PDBs.
When you connect without specifying any service, you are automatically placed in the CDB. The extended strings parameter is ignored for the CDB: the limit remains 4000 bytes. The following connects to the CDB. Creating a table with a long string is rejected, just like in your case:

Do not want to show time stamp which is an out of the box functionality

I need to just show the date stamp when used as an information field, but out of the box functionality shows both date and time stamp. Is there a way, I can only show date stamp and not time stamp. Is there a way I can add a side effect
For example: Implemenation date: 7/17/13 12:00 AM (This is how it is right now)
Implemenation date: 7:17/13 (I want it to be displayed like this)
Thanks
Chetan
The answer is not obvious, as some critical details are missing. The main one being, what client program is retrieving and displaying the data? That's where the change needs to be made. Oracle stores date and time in a variety of datatypes, but regardless of datatype (DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, etc), the date is stored in an internal format in the database. When a date is selected from the database, it's up to the client program to decide how to display the information.
For example, if the client program is SQL*Plus, you can set NLS_DATE_FORMAT to control how a date is displayed.
For example:
-bash-4.1$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Nov 19 10:38:49 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter nls_date_format
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_date_format string
SQL> select sysdate from dual;
SYSDATE
---------
19-NOV-13
SQL> alter session set nls_Date_format = 'mm:dd/yy';
Session altered.
SQL> select sysdate from dual;
SYSDATE
--------
11:19/13
So, that's an example for SQL*Plus client. You need to determine how to set the date format for your client, which you have thus far, not specified.
Hope that helps...

Resources