Sub topic 10
Troubleshooting Common Oracle Practice Database Problems
Assume you know basic SQL, can use a terminal, and understand that a database client connects to a database server. The examples use Docker, SQL*Plus, Autonomous Database, and FreeSQL.
Most setup problems come from one of four causes:
- The database server is not ready.
- The client uses the wrong host, port, or service name.
- The username or password is wrong.
- The selected environment has a different connection method or limit.
Use this order when troubleshooting:
- Confirm that the environment is running.
- Confirm that the connection details match that environment.
- Confirm that the account and password are valid.
- Test with a small SQL statement.
Find the Layer That Failed
A connection has several layers. A failure at one layer can make later checks misleading.
For a local container, start with its status and logs:
docker ps -a --filter name=oracle-free
docker logs --tail 100 oracle-freeThe container can be running while Oracle Database is still starting. Wait for a message such as DATABASE IS READY TO USE!. Do not repeatedly try to connect during the first-time setup.
If the container exited, inspect the logs for the first error. Common causes include an invalid image name, insufficient memory, or a port that is already in use.
Fix Local Container Connections
The -p 1521:1521 option maps port 1521 on your computer to port 1521 inside the container. Check the mapping with:
docker port oracle-freeYou should see a mapping for TCP port 1521. If another program already uses that port, start the container with a different host port:
docker run -d --name oracle-free \
-p 1522:1521 \
-e ORACLE_PWD='ChangeMe_123' \
container-registry.oracle.com/database/free:latestIn this example, the client must use port 1522, not 1521:
sqlplus sys/ChangeMe_123@localhost:1522/FREEPDB1 as sysdbaThe service name also matters. Oracle Database Free commonly provides the root container database service FREE and the pluggable database service FREEPDB1. A user and table created in FREEPDB1 are not automatically visible in the root container.
A message such as ORA-12514: listener does not currently know of service requested usually means that the service name is wrong or that the database has not finished starting. Check the logs and retry with FREEPDB1.
A message such as ORA-01017: invalid username/password indicates an authentication problem. Check spelling, capitalization, and the password used when the database was first initialized. Changing ORACLE_PWD on a later docker start does not reset an existing database password. That variable is used during initial setup.
Troubleshoot Autonomous Database
Autonomous Database does not use your local Docker port. In Oracle Cloud, open the database page and use Database Actions for browser-based SQL. If Database Actions does not open, confirm that the database state is Available, then refresh the page and check your cloud login.
For a desktop client, download the database credentials wallet and use the connection information supplied with it. A wallet contains certificates and configuration files used for encrypted TLS connections. The client must be configured to find the wallet directory.
Typical problems include:
- The database is still being provisioned.
- The wallet is missing, expired, or points to the wrong database.
- The client uses a service name from another Autonomous Database.
- A network rule, proxy, or firewall blocks outbound TLS traffic.
- The
ADMINpassword is incorrect.
Autonomous Database requires encrypted connections. A plain local-style string such as localhost:1521/FREEPDB1 cannot connect to it. Use Database Actions or a wallet-enabled client instead.
Troubleshoot FreeSQL
FreeSQL runs in a browser, so it does not require a local listener, Docker, wallet, or SQL*Plus installation. If a script fails, first check that you selected the intended schema and that the browser session is still active.
FreeSQL may restrict some administrative operations. A script that creates users, changes instance settings, or accesses administrative views can fail even when ordinary table practice works. Run a smaller script containing CREATE TABLE, INSERT, COMMIT, and SELECT.
The same SQL can behave differently across environments because the account, Oracle version, available privileges, and session settings differ.
Compare the Most Common Symptoms
| Symptom | Likely cause | First check |
|---|---|---|
| Connection refused | Container stopped or port is wrong | `docker ps` and `docker port` |
| ORA-12514 | Wrong service or startup incomplete | Use `FREEPDB1` and read the logs |
| ORA-01017 | Incorrect credentials | Check the original password |
| Database Actions unavailable | Autonomous Database is not ready | Check its cloud status |
| SQL permission error | User lacks a privilege | Use a development user with the required grant |
After connecting, verify the session before running a tutorial script:
SELECT sys_context('USERENV', 'CON_NAME') AS container_name,
sys_context('USERENV', 'SESSION_USER') AS session_user
FROM dual;The container name confirms whether you are in FREEPDB1 or another container. The session user confirms that you are not accidentally connected as a different account.
Exercise
A local container is running, but sqlplus app_user/...@localhost:1521/FREEPDB1 returns ORA-12514. What should you check first?
Show answer
Check the container logs to confirm startup is complete, then verify that the connection uses the correct FREEPDB1 service name and the published host port.