This question already has answers here:
Why my Oracle 10g does not have the scott account?
(2 answers)
Closed last month.
recently download oracle 11g, tried login using scott, turns out scott doesnt exist . I logged in using sys as sysdba and ran 'show pdbs' but it showed 'unknown show option pdbs'.
I looked up online and found that i need to run the scott.sql. But then i couldnt find the scott.sql file in the expected location. pls help
11g is rather old, there's no PDB there.
As you're logged as SYS, run the following command and say what status you got (in my database, it is OPEN):
SQL> select account_status from dba_users where username = 'SCOTT';
ACCOUNT_STATUS
--------------------------------
OPEN
SQL>
If it is LOCKED (which might be), then run
SQL> alter user scott account unlock;
User altered.
SQL> alter user scott identified by tiger;
User altered.
SQL>
and - finally - connect:
SQL> connect scott/tiger
Connected.
SQL>
If you really don't have that schema, create it. See this for more info.
Related
I have download the oracle sql developer version 21.2.1 and I want to create a new connection. But I do not have any schema created. Can somebody help me or any links would be helpful.
Note: I have searched on youtube and google. All the tutorials that I have seen seems to have already a schema.
Well, SQL Developer you downloaded is just a tool you'd use to access an Oracle database. What you need next is the database itself. Once you download & install it, create user (schema). This is 11g database version example:
Connect as a privileged user (SYS if you don't have any other; and you probably don't) using SQL*Plus (command-line tool):
SQL> connect sys/password_goes_here#xe as sysdba
Connected.
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USER_DATA
Create user:
SQL> create user will identified by ashoti
2 default tablespace user_data
3 temporary tablespace temp
4 quota unlimited on user_data;
User created.
Grant privileges which will allow that user to actually do something:
SQL> grant create session to will;
Grant succeeded.
SQL> grant create table to will;
Grant succeeded.
That's it; connect as newly created user:
SQL> connect will/ashoti#xe
Connected.
SQL> create table test as select sysdate as datum from dual;
Table created.
SQL> select * from test;
DATUM
----------
06.10.2021
SQL>
It works; moreover, it means that you should now be able to establish connection via SQL Developer as well.
This question already has an answer here:
Oracle ORA-01031: insufficient privileges while creating user
(1 answer)
Closed 1 year ago.
CREATE USER STUDENT IDENTIFIED BY "pass12";
I am creating user and password by this syntax but getting error:
ORA-01031: insufficient privileges
How can I solve it?
User you're currently connected to doesn't have privileges to create other users.
One of such is my SCOTT user:
SQL> show user
USER is "SCOTT"
SQL> create user student identified by pass12;
create user student identified by pass12
*
ERROR at line 1:
ORA-01031: insufficient privileges
But, if I connect as a privileged user (such as SYS), then:
SQL> connect sys as sysdba
Enter password:
Connected.
SQL> create user student identified by pass12;
User created.
SQL>
I am not very experienced with Oracle and BFILEs, so I apologize if the answer to my question is very obvious.
I am using Oracle SQL Developer and Oracle Database 12c Enterprise Edition.
I try to save images externally via BFILE. For this I created a directory and a table and inserted the BFILEs:
DROP DIRECTORY PICTURE;
CREATE OR REPLACE DIRECTORY PICTURE AS 'C:\PICTURE';
DROP TABLE TEST1;
CREATE TABLE TEST1( NR INTEGER, IMAGE BFILE );
INSERT INTO TEST1 VALUES( 1, BFILENAME('PICTURE','IMG.png') );
The code runs without errors. Now I want to check that I have pasted the code correctly. To do this, I use the following function.
SELECT DBMS_LOB.GETLENGTH(IMAGE) FROM TEST1;
After executing the function, I get the following error message.
ORA-22288: file or LOB Operation GETLENGTH failed
The system could not find the specified path.
ORA-06512: in "SYS.DBMS_LOB", line 850
What can be the reason? Could it be that I am not allowed to specify the path like this? The path points to a folder on my PC. Can the program access it? If that's not the problem, what could be causing the error message?
UPDATE:
When I run the Grand command to assign me the rights, I get the following error message
SQL > GRANT READ, WRITE ON DIRECTORY PICTURE TO XYZ;
ORA-01749: you may not GRANT/REVOKE privileges to/from yourself
I assumed that means I already have the rights.
Connect as XYZ works:
SQL> show user
USER is "XYZ"
SQL> select * from all_directories where directory_name = 'EXT_DIR';
OWNER DIRECTORY_NAME DIRECTORY_PATH
------------------------------ ------------------------------ --------------------
SYS PICTURE c:\PICTURE
SQL>
For the rest of the code, my output coincides with the output from Littlefoot's answer. Only with the .getlength () function do I get the error message described above.
It could be that the problem is that my PC is not a database server. I use a PC with Windows 10. I have downloaded the following Version:
https://www.oracle.com/de/tools/downloads/sqldev-v192-downloads.html
And I run the application every time using the following icon from the Explorer:
SQL Developer Icon
In the SQL Developer I then connected to a database instance. In the database instance a scheme is available to me with which I can set up and manage files. The PICTURE folder with the pictures is, as I said, on my PC in drive C: . I am trying to create a directory which then accesses this folder. Can I do that without having specially configured my PC?
Directory is an Oracle object which points to a filesystem directory which is (usually; let's pretend "always") located on a database server. If your PC isn't one, then it won't work.
As directory points to c:\picture on the database server,
that directory must really exist there
image must be in it
make sure that you didn't miss the actual file name
you, as user, have to have (at least) read privilege to access it.
that's what is missing in code you posted. User (SYS, I presume), who created the directory, should have ran e.g.
grant read, write on directory picture to sql_user;
(or whichever user you really use).
Here's an example. I'm running Oracle 11gXE on my laptop (so it is a database server). File is located in c:\temp directory which is set to be Oracle EXT_DIR directory.
c:\Temp>dir robco.jpg
Volume in drive C is OSDisk
Volume Serial Number is 7635-F892
Directory of c:\Temp
25.09.2017. 20:27 6.427 robco.jpg
1 File(s) 6.427 bytes
0 Dir(s) 234.166.730.752 bytes free
c:\Temp>
Let's see the Oracle side: first, grant access to user scott (who will load the file):
SQL> show user
USER is "SYS"
SQL> grant read, write on directory ext_dir to scott;
Grant succeeded.
SQL>
Connect as scott:
SQL> show user
USER is "SCOTT"
SQL> select * from all_directories where directory_name = 'EXT_DIR';
OWNER DIRECTORY_NAME DIRECTORY_PATH
------------------------------ ------------------------------ --------------------
SYS EXT_DIR c:\temp
SQL>
Create a table, insert a row, check the contents:
SQL> CREATE TABLE TEST1( NR INTEGER, IMAGE BFILE );
Table created.
SQL> INSERT INTO TEST1 VALUES( 1, BFILENAME('EXT_DIR','robco.jpg') );
1 row created.
SQL> SELECT * FROM test1;
NR IMAGE
---------- --------------------------------------------------
1 bfilename('EXT_DIR', 'robco.jpg')
SQL> SELECT DBMS_LOB.GETLENGTH(IMAGE) FROM TEST1;
DBMS_LOB.GETLENGTH(IMAGE)
-------------------------
6427
SQL>
So, if everything is done properly, it works.
Is there a means of querying a database environment to retrieve all Oracle APEX application IDs, together with the workspace name they belong to?
I basically want to create an LOV within an Oracle APEX app that can see all APEX application IDs and Workspaces.
I tried the APEX_APPLICATIONS view but that only displays info within the workspace you are in. I want to see all workspaces and application ids.
Is granting the apex_administrator_role to the parsing schema plausible? Your query would probably still want to exclude internal workspaces such as INTERNAL, COM.ORACLE.CUST.REPOSITORY and COM.ORACLE.APEX.REPOSITORY
SQL> conn hr/hr#XE1
Connected.
SQL>
SQL>
SQL> select count(1)
2 from apex_applications;
COUNT(1)
----------
0
SQL> disconnect
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> connect sys/oracle#XE1 as sysdba
Connected.
SQL> grant apex_administrator_role to hr;
Grant succeeded.
SQL> commit;
Commit complete.
SQL> conn hr/hr#XE1
Connected.
SQL> select count(1)
2 from apex_applications
3 ;
COUNT(1)
----------
60
note: This will also give your schema access to the APEX_INSTANCE_ADMIN API.
I am trying to create a new schema in SQL Developer:
CREATE USER admindba
IDENTIFIED BY pwd4dba
DEFAULT TABLESPACE tbs_perm_01
TEMPORARY TABLESPACE tbs_temp_01
QUOTA 20M on tbs_perm_01;
I am getting error
SQL Error: ORA-00959: tablespace 'TBS_PERM_01' does not exist
00959. 00000 - "tablespace '%s' does not exist"
What is wrong? Can anyone clear the error?
I think, following steps will help you.
Login as sysdba in oracle developer.
Execute the create user statement. For example, create a new user named smith with a password of password as follows:
CREATE USER smith IDENTIFIED BY password;
Grant specific access to the new schema user. For example:
GRANT CREATE TABLE TO smith;
(Or this one to give all privileges to this user )
GRANT ALL PRIVILEGES TO smith;
Verify schema creation. For example, use the following query for new user smith:
SELECT username, account_status FROM dba_users
WHERE username = 'SMITH';
Then login as smith
I refer from this link
You have to create the tablespace first. Example:
create tablespace tbs_perm_01 datafile '/path/to/data/mydatafile01.dbf' size 1G autoextend on;
You will likely have create the temporary tablespace too. Then you can create the user that will use those tablespaces.
connect as sys to your server and check tablespaces
it looks that the tablespace TBS_PERM_01 is missing
select * from dba_tablespaces
select * from dba_tablespaces where tablespace_name = 'TBS_PERM_01'