Can't create HR schema on Oracle 21c (SP2-0310) - oracle

I'm new to Oracle and i'm trying to install HR schema but error occurs.
SP2-0310: unable to open file "SUB__CWD/human_resources/hr_cre.sql" connecting and granting seems work but this error occurs and i can't create hr schema..
I searched and tried many ways, but I couldn't find the right solution.
I'm using oracle 21c version and my OS is windows10.
I entered like this
sys as sysdba
alter session set "_ORACLE_SCRIPT"=true;
#?/demo/schema/human_resources/hr_main.sql hr users temp {password} $ORACLE_HOME/demo/schema/log/ localhost:1521/XE
I tried Installing Sample Schemas like this and installation of the sample schemas like this but it didn't work.
Thanks in advance

Related

How to create a table in 18c express edition

I just finished installing oracle 18c express edition on windows 8 laptop. During the installations, I did not enter any user name. I entered my password though.
At the end of the installation, I get this screen:
I connected Oracle database using sql plus as follows:
SQL> / as sysdba
I also entered the following commands in sql plus and all have worked. I was just following youtube tutorial without understanding everything.
SQL>alter pluggable database all open;
SQL>alter pluggable database all save state ;
SQL>select name from v$pdbs;
SQL> connect sys/oracle#localhost:1521/XEPDB1 as sysdba;
SQL> alter user hr identified by hr;
SQL> alter user hr account unlock;
SQL>connect hr/hr#localhost:1521/XEPDB1;
SQL> select * from employees;
SQL> CREATE TABLE TEST1 (CUSID NUMBER(10) NOT NULL);
This is the first time I am doing it. I tried to connect to a database using SYS as the user name and the password but did not connect.
SQL> Enter user name: SYS;
Enter password: Welcome1
SYS - During the installation, it said sys, system, and pdbadmin accounts. So I assume sys could be one of the user names.
Password - I entered the same password I used at the time of installation. I can connect to the database using / as sysdba. But I am not sure what this code meaning and what the user name and password and what database it is trying to connect. What would be the database name, user name and password?
Update 1
I created a connection in sql developer. Below shows the connection properties.
I created a table(sqldev2) in sql developer, inserted rows, and selected the data just fine.
Next, I went to sql plus and tried to select the same data from sqldev2 table but it shows no rows selected. I am assuming sql plus and sql developer may be pointing to two different databases?
How can I tell which database I am connected using the sql developer?
How can I connect to the same database using the sql plus?
This way I can work on the same database using the sql plus and sql developer.
Update 2
In Eclipse IDE, I had this code to connect to database. After that, I created a table (testtble) in Eclipse.
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver Loaded");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:#localhost:1521/xe", "sys as sysdba","pw");
In SQL Plus, I connected to the db using "/ as sysdba". After that, I also tried to select * from testtble but it shows no table. I am assuming sql plus might be pointing to something different than what I used in eclipse. How should I connect to the database from SQL plus so I could see the table "testtble" in sql plus?
To check in which pluggable database you are currently connected in SQL*Plus use:
show con_name
If you connect to Oracle using a connect string that is using a database service mapped to a pluggable database (PDB), you will be connected directly to the related PDB.
Try different connections strings and check with show con_name.

Unlocking SCOTT user in oracle 19c

Trying to unlock SCOTT in oracle 19c.
alter user scott account unlock identified by tiger;
ERROR Message:
ORA-01918: user 'SCOTT' does not exist
From documentation:
Starting from Oracle 12cR2, only HR schema is provided via installation. All other sample schema scripts are available on GitHub at https://github.com/oracle/db-sample-schemas/releases/latest
SCOTT schema is no longer provided in the sample schemas, you could manually create it using the scripts from older Oracle versions or use the HR and other sample schemas.
Once you install the sample schemas manually in PDB, you could then unlock them and use. See Oracle Multi-tenant DB Post Installation Mandatory Steps
In ORACLE 19C How TO CHANGE sysdba password.

Why can't I select a pre-created schema in Oracle 18c XE when creating a new workspace in APEX?

i have just started to work with oracle and apex, so I don't know my way around yet.
I have installed oracle 18c xe and connected it to the sql developer. Then I have installed apex 19.1 and successfully connected to it via localhost and the admin user.
After that i after that i created a new schema in the database and grant them diferent privileges. Now I wanted to create a new workspace and use this pre-created schema but it is not displayed.
I've tried it a few times, but it doesn't work.
What could be the reason?
So far, i've tried to determine the current Application Express engine schema with SELECT DISTINCT TABLE_OWNER FROM all_synonyms
WHERE SYNONYM_NAME = 'WWV_FLOW' and OWNER = 'PUBLIC' but here i don't get a value. I saw this on the oracle manual https://docs.oracle.com/database/apex-18.1/AEADM/managing-schemas.htm#AEADM232
The following steps on this page do not work either
If you've created the schema and created the workspace (it's not clear if you've done that second part), you probably need to add the schema to the workspace. You can do that with APEX_INSTANCE_ADMIN.ADD_SCHEMA. Or you can log into the INTERNAL workspace in the Apex designer and add it there.

ORA-01219 - "database or pluggable database not open: queries allowed on fixed tables or views only"

I've just installed oracle database 18c on my windows 10 machine. Then I used Oracle SQL Developer to login to the database that I've created during the installation with connection information below:
The connection was successful and when I tried to open the Tables, it showed an error OCA-01219:
I've found this solution:
ORA-01219: database not open: queries allowed on fixed tables/views only
that trying to make the database open. I have tried this but still no success, my database status:
Can anyone please help to to solve this problem? Thank you very much in advanced.
I run into the same problem after having to restart the Oracle Service. The problem was the state of the pluggable database not that of the instance itself, which was "open" like in your case.
The following command worked for me (please replace "orclpdb" with your pluggable DB name):
alter pluggable database orclpdb open;
If output of 'select status from v$instance' is open, can you please execute below query and let me know the out put:
select name, open_mode from v$database;
Also, please let me know if you are trying to connect pluggable database. In case you are connecting to pluggable db, then run below query:
alter session set container='';
Then after apply above approach. please let me know if any query further

New to Oracle SQL developer

I installed Oracle SQL developer on my personal computer.
I want to create my own tables in it and work on them.
But, when I try to make the basic connection, it gives an error below
"network adapter could not make the connection".
Can someone please give a detailed explanation about how can I create my own tables and what I should do to connect to some database?
You have to install Oracle database to create your own tables. You can download Oracle XE from this link.
For a detailed explanation about how to connect to a database, this tutorial comes first when you google it.
This answer is for windows user. And assume that you have installed oracle database, as answered.
Open cmd: (win+r, input cmd, enter).
run command:
sqlplus / as sysdba
create a tablespace:
create tablespace <tablespace-name>
create user:
Create user <username> identified by <password> default tablespace <tablespace-name> quota unlimited on <tablespace-name>;
open oracle sql developer, and add a link with the information in step 4. Link type should be set as local! Link type should be set as local! This may be the direct answer to your question.
Now you could run sql shell in sql developer.

Resources