I have a problem with connecting data from my local oracle user schema (USERS table space) and apex workplace.
Could you adivise how I can connect apex workplace with my existing schema?
It looks like APEX uses its own table space and ignores my schemas.
Here are my screenshots:
SQL Developer screen Creating a new workspace screen
Forgot one significat thing to mention: schema Pavel in Apex and schema Pavel in SQL Developer are different. Tables, which are created in the Apex in schema Pavel, are not seen in SQL Developer.
No apex user screen
apex create workplace and new schema dialog (different table space), the schema is not visible in sql developer
See whether following helps:
Connect to the database as SYS and check your Apex users:
SELECT * FROM ALL_USERS WHERE USERNAME LIKE 'APEX%',
Suppose there's APEX_180200 listed (and you use it). Then:
ALTER SESSION SET CURRENT_SCHEMA = APEX_180200;
BEGIN
APEX_INSTANCE_ADMIN.UNRESTRICT_SCHEMA(P_SCHEMA => 'ADAM');
COMMIT;
END;
/
Now check whether you can assign the ADAM schema to your workspace.
you will need to add your existing schema to your APEX workspace:
check out oracle docs for this:https://docs.oracle.com/database/121/AEAPI/apex_instance.htm#AEAPI253
BEGIN
APEX_INSTANCE_ADMIN.ADD_SCHEMA('MY_WORKSPACE','FRANK');
END;
The problem was in misunderstanding oracle database architecture.
The APEX data was stored in the pluggable database, while the default connection in SQL Plus was to the root container cdb$root.
alter session set container = XEPDB1;
Related
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.
I am working in an Oracle APEX application and am trying to query tables in another schema (that another Oracle APEX application sits on) to pull in data to my application.
The applications are hosted within the same APEX workspace and on the same Oracle 11g instance. Our application have tables that are structurally the same as the tables we're trying to query in the other schema.
Using the schema prefix (SELECT * FROM "SCHEMA2".TABLE1;) when querying is throwing an error that the tables do not exist (ORA-00942: table or view does not exist)
The second thing I tried is creating a database link between the two schemas, but when trying to establish the connection I'm getting the following error: ORA-01031: insufficient privileges
Can someone identify where I'm going wrong here / help me figure out how to query the other schema?
Database link is used when there are different databases involved; your schemas reside in the same database which means that the first attempt was correct: prefixing table name with its owner, e.g.
SELECT * FROM SCHEMA2.TABLE1
However, first connect as schema2 user and issue
grant select on table1 to schema1;
Otherwise, schema1 can't see the table. If schema1 is supposed to do something else with that table, you'll have to grant additional privileges, such as insert, update, delete, ....
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.
I've installed Oracle Apex 19.1 on Oracle XE 18c. I then created an Apex workspace for which Apex automatically creates a schema which I called MYSCHEMA. Apex reports "Database user MYSCHEMA created with default tablespace APEX_1270566619000339 using datafile D:\APP\USER\PRODUCT\18.0.0\ORADATA\XE\XEPDB1\APEX_1270566619000339.DBF". I also created a table in MYSCHEMA called EMPLOYEES.
I previously had a 11g XE which I uninstalled and replaced with the Oracle XE 18c. I could connect using the same XE database from that previous database in TOAD. It automatically picks up the new OraDB18Home1. I didn't change the tnsnames.ora. I can connect to the MYSCHEMA user using the same password as SYS.
However I don't see the EMPLOYEES table created in Apex when I use
select *
from all_tables
where table_name like '%EMPLOYEE%';
Where am I going wrong?
PS. I have now noticed that "Connect as SYSDBA" was on and it fails to connect to the user MYSCHEMA if I choose "Connect as Normal". I have tried all the passwords (2) I have used in setting this up. Not sure if there is a default password I should be using.
I then created an Apex workspace for which Apex automatically creates a schema which I called MYSCHEMA
You can do that, but don't have to. If you already have a schema in your database which contains tables that will be used while developing an Apex application, you can assign that schema to the workspace.
But OK - you chose to create a new schema.
As you can connect as SYS (which has to be AS SYSDBA), do so. Change MYSCHEMA's password by running
alter user myschema identified by some_password;
Then create a new connection in TOAD, using MYSCHEMA as username and SOME_PASSWORD as its password. That connection will be NORMAL.
I have created Global Temporary table in oracle and inserting the data through my application, and its working fine for me when i connect to database with "system" as the username. Where as i have created one more user in the database with "user1" and have given "Grant all" privileges to this user also. Now when am connecting to database with "User1" as the username and running the application, the data is not inserting into Global temporary table.
But when i try to insert data from sql developer tool its inserting.
With system user through application also working, whereas with user1 its not inserting. Am not getting whats behind going as am not that much DB expert.
Please have any idea suggest me. I have all privileges also. Thanks in advance.
Fist, the table MUST be in other schema than SYS or SYSTEM. Create it on "User1".
Second, you must be sure that you select from the same table. Prefix the table with the schema when inserting and also when reading.
Also be sure that you are not in the situation of table created with ON COMMIT DELETE ROWS and some AUTOCOMMIT ON in Sql Developer.