I've been trying to access the dba_data_files table to see whether the autoextend is turned on for my data files. However, even though I'm using Oracle 10g, this table seems to not exist:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from dba_data_files;
select * from dba_data_files
*
ERROR at line 1:
ORA-00942: table or view does not exist
Is there some other way to check and even change whether a data file for a particular tablespace has the autoextend option turned on?
You should make sure you're connecting with an account that has privileges to see this view - try the SYSTEM account if you have that password, otherwise have your DBA grant the SELECT_CATALOG_ROLE to the account you are using.
You should be able to do this through the oracle enterprise manager under Administration
Related
I'm trying to keep/pin frequently accessed table in buffer, but i see the db_keep_cache_size parameter is deprecated in 12c. is there any alternative way to perform same on 12c?
my oracle version: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit.
I tried below steps in 12c and it executed without any error, but not sure it will have any impact on 12c.
show parameter keep;
alter system set db_keep_cache_size=1M scope=both;
show parameter keep;
SELECT SEGMENT_NAME, BUFFER_POOL from dba_segments where SEGMENT_NAME='cust_table' and owner='services';
alter TABLE services.cust_table storage (buffer_pool keep);
Could someone please suggest, whether above steps are valid in 12c?
Thanks in advance.
Laks
I am unable to start a container inside oracel 18c xe , when using command "Alter Datbase Open" it gives error
"ORA-12954: The request exceeds the maximum allowed database size of 12 GB"
Upon searching internet i have found a way which says
"The only way was to append the XE datafiles in a "auxiliary" Oracle 18c home"
But i am unable to understnad how to mount only single tablespace from my xe database into Home version and remove not required stuff from the tablespace to free up space. Any help regarding this is appreciated
There is a bug in Oracle XE which allows a BigFile tablespace being created in a container DB and grow beyond the DB size limit imposed by Oracle Express Edition. The bug is fixed on version 19.1.0.
Unfortunately there is no workaround for this bug.
You might try to open the database with the problematic tablespace in OFFLINE and perform the following actions:
1.Start the database in mount state
SQL> STARTUP MOUNT
2.Put the tablespace in offline,
SQL> ALTER TABLESPACE xxxxx OFFLINE IMMEDIATE;
3.Open the database
SQL> ALTER DATABASE OPEN ;
In this status, the problematic tablespace is offline, so you can't access any element on it. Remove everything you don't need from other tablespaces ( USERS , etc) and resize others to a lower size ( UNDO , TEMP, SYSTEM ), if possible. Then, try also to resize the problematic datafile ( if the data is beyond the HWM it won't work ).
Finally, put the tablespace that was offline online again and see if the total size of the database is lower than the limit. Then try to open the database.
I have a strong SQL Server background but fairly new to Oracle. I have a Windows 10 Home Edition. I installed Oracle 10g along with Oracle SQL Developer. What credentials/settings do I need to do to specify in SQL Developer to connect to the default Oracle database (if one exists)?
Well, that depends on what exactly you installed. Which Oracle 10g version? XE? Standard? Enterprise? As far as I can tell, Oracle was never certified on any Windows Home edition. It's not that it won't work at all, it just depends.
By the way, why 10g? It is outdated; the most recent version is 18c (available for download on Oracle Technology Network, https://www.oracle.com/downloads/).
As you are new to Oracle, I'd suggest you to use XE (Express Edition). Even 10g would do, I presume (if that's what you installed). For amusement, I have 11gXE on my Windows 7, works well. Why? Because it is a small footprint database, fully functional, free to use. It has its restrictions (such as 1 CPU, 1 GB RAM, 8 GB of user data) (those restrictions depend on XE version), but it is OK for most purposes.
Moreover, it automatically installs the database you can start using. During the installation process, you're asked for password for SYS (and SYSTEM) users (they "own" the database). Once you know these, you're the boss.
In XE, you have pre-installed schemas (i.e. users with their objects: tables, views, ...) which are named Scott, HR (Human Resources). By default, they are locked so you'd have to connect to the database as SYS and unlock them.
As you already have SQL Developer, you'd create a connection:
username = SYS
password = you know it
connection type = Basic
role = default
hostname = localhost
port = 1521 (it is the default; if you use some other port, you'll know it)
SID = xe (by default)
Once you're connected, check which users you have
select username, account_status from dba_users;
As I've said, Scott and/or HR might be interesting for you as they already have some objects. See their status; if they are locked, you'd unlock them and set new passwords as
alter user scott account unlock;
alter user scott identified by tiger;
Now you can create a new connection to Scott, following the same instructions as above.
If you want to create your own user, no problem. Still connected as SYS, check available tablespaces (this is SQL*Plus output, command-line tool; in SQL Developer, you won't have the "SQL>" prompt):
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
SQL> create user sam identified by nasr
2 default tablespace users
3 temporary tablespace temp
4 quota unlimited on users;
User created.
Once the user is created, it can't do anything - you have to grant it certain privileges, such as :
SQL> grant create session, create table, create view to sam;
Grant succeeded.
Create session allows it to establish connection; another two will let you create tables and views. If you - as the time goes by - need yet another privilege, connect as SYS and grant it the same way.
Now you can connect to it (that would be yet another connection in SQL Developer) and ... do something:
SQL> connect sam/nasr
Connected.
SQL> create table test (id number);
Table created.
SQL> insert into test (id) values (100);
1 row created.
SQL>
So: if you have anything but XE, I'd suggest you to uninstall it. Use Universal Installer to do that. Then download and install XE. In my opinion, as Oracle beginner, that should make your life easier.
On the other hand, if you want to practice to be a DBA, then XE probably isn't the right choice as there can be only one - preinstalled - database.
I am new to oracle database and therefore is trying to follow the office guide. (link to the guide) However, it seems that the guide is for Windows 7, so in step 2 - creating database user, it says:
Display the SQL command prompt window. For example, on Windows, click Start, then Programs (or All Programs), then Oracle Database 11g
Express Edition, and then Run SQL Command Line.
And in windows 8, there is not start button. I try to search the menu using keyword oracle but nothing with similar name is found. I tried to go to the Program Files directly but also no similar file found. So, how should I create a database user on Windows 8?
I don't use Windows 8, but I guess that it must have some kind of a "command prompt" (you know, a program that lets you perform text-based (command-line) functions; its window is black with white letters. Once opened, the cursor blinks at the prompt, waiting for your commands). Try to find it, run it.
Then you'll be able to connect to your database (you do have it installed, right?) as
C:\> sqlplus sys/your_sys_password#database as sysdba
You'll be connected as SYS (be careful! It is a powerful user and its misuse might break your database! I'd suggest you to create another user, for example "mydba", grant it DBA role and let it perform DBA actions).
If you're unsure of what your tablespaces are, run
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USER_DATA
APEX
APEX_9695076087226093
7 rows selected.
SQL>
as you'll need at least two of them. Now create your new user:
SQL> create user mike identified by lion
2 default tablespace user_data
3 temporary tablespace temp
4 profile default
5 quota unlimited on user_data;
User created.
SQL> grant create session to mike;
Grant succeeded.
SQL>
Granting create session, it'll be able to connect to the database, but won't be able to do anything else, so you'd have to grant it some more privileges (such as create table, create view, create procedure etc.).
SQL> connect mike/lion#orcl
Connected.
SQL> create table test (id number);
create table test (id number)
*
ERROR at line 1:
ORA-01031: insufficient privileges
SQL>
In sqlplus under normal schema account (not sys), query select * from v$instance; runs OK. But when create view which references it, error happens:
create or replace view vw_test_instance
as
select * from V$instance;
SQL Error: ORA-01031: insufficient privileges
If switch v$instance to any normal table like select * from dual;, then the view created with no problem.
Oracle version:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
The back ground is I'm upgrading a database run on 10g to 11g, things used to work on 10g just broken on 11g... Can I fix it without touching source code of views? Appreciated!
This is related to user GRANTS.
1. GRANT SELECT ON V$INSTANCE TO <USER>; --> Will be provided by SYSDBA
2. Then try. It will definitley help.
This link will also help you to understand why this kind of behaviour occurs.
v$views Grant
"query select * from v$instance; runs OK. But when create view which references it, error happens:"
The error you get - SQL Error: ORA-01031: insufficient privileges - indicates that your user lacks the privileges to create a view.
" things used to work on 10g just broken on 11g"
Clearly on 10g privileges your user had privileges to create views and on 11g they do not.
The most likely explanation is that your user relies on the CONNECT role. In older versions of Oracle this role had several system privileges, including CREATE VIEW. This implicit granting of privileges was always dodgy. However, in 11g this changed and the role now only has CREATE SESSION. All other privileges must be granted explicitly. This is mentioned in the 11g Upgrade docs and explained in depth by the 11g Security Guide Find out more.