Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Update oracleContainer to use new password and serviceName #2357

Closed

Conversation

KyleAure
Copy link
Contributor

@KyleAure KyleAure commented Feb 14, 2020

Fixes #2356
Fixes #2215

@kiview
Copy link
Member

kiview commented Feb 15, 2020

Since we don't have CI for Oracle, I will built the Docker images on my machine and test by hand.

@kiview kiview self-assigned this Feb 15, 2020
@kiview
Copy link
Member

kiview commented Feb 17, 2020

SimpleOracleTest fails for me with official (self-build) image oracle/database:18.4.0-xe:

Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12526, TNS:listener: all appropriate instances are in restricted mode

Is this to be expected?

@KyleAure KyleAure changed the title Updating oracle container to accept new password WIP Update oracleContainer to use new password and serviceName Feb 17, 2020
@KyleAure
Copy link
Contributor Author

This is not something I would expect. I have been testing against an 11g-R2 container and have not run into this. Let me see if I can replicate this using 18c.

@KyleAure
Copy link
Contributor Author

@kiview Looks like I ran into the same error here:

Listener refused the connection with the following error: ORA-12526, TNS:listener: all appropriate instances are in restricted mode 

Output from the container indicated that the database had only installed up to 34%

[02/17/2020 14:59:31:619 CST] 001 JdbcDatabaseContainer          waitUntilContainerStarted      I Waiting for database connection to become available at jdbc:oracle:thin:system/oracle@localhost:33890:xe using query 'SELECT 1 FROM DUAL'
[02/17/2020 14:59:31:649 CST] 046 OracleTraceTest                oracle                         I ORACLE PASSWORD FOR SYS AND SYSTEM: 6450eba1b853938f
[02/17/2020 14:59:31:780 CST] 046 OracleTraceTest                oracle                         I Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
[02/17/2020 14:59:31:781 CST] 046 OracleTraceTest                oracle                         I Confirm the password:
[02/17/2020 14:59:31:790 CST] 046 OracleTraceTest                oracle                         I Configuring Oracle Listener.
[02/17/2020 14:59:34:865 CST] 046 OracleTraceTest                oracle                         I Listener configuration succeeded.
[02/17/2020 14:59:34:865 CST] 046 OracleTraceTest                oracle                         I Configuring Oracle Database XE.
[02/17/2020 14:59:45:483 CST] 046 OracleTraceTest                oracle                         I Enter SYS user password: 
[02/17/2020 14:59:45:486 CST] 046 OracleTraceTest                oracle                         I � �****************� �****
[02/17/2020 14:59:45:487 CST] 046 OracleTraceTest                oracle                         I Enter SYSTEM user password: 
[02/17/2020 14:59:45:489 CST] 046 OracleTraceTest                oracle                         I ****************� �****
[02/17/2020 14:59:45:490 CST] 046 OracleTraceTest                oracle                         I Enter PDBADMIN User Password: 
[02/17/2020 14:59:45:492 CST] 046 OracleTraceTest                oracle                         I ***************� �*
[02/17/2020 14:59:46:139 CST] 046 OracleTraceTest                oracle                         I Prepare for db operation
[02/17/2020 14:59:46:317 CST] 046 OracleTraceTest                oracle                         I 7% complete
[02/17/2020 14:59:46:317 CST] 046 OracleTraceTest                oracle                         I Copying database files
[02/17/2020 15:01:23:732 CST] 046 OracleTraceTest                oracle                         I 29% complete
[02/17/2020 15:01:23:747 CST] 046 OracleTraceTest                oracle                         I Creating and starting Oracle instance
[02/17/2020 15:01:57:977 CST] 046 OracleTraceTest                oracle                         I 30% complete
[02/17/2020 15:02:12:715 CST] 046 OracleTraceTest                oracle                         I 31% complete
[02/17/2020 15:02:12:744 CST] 046 OracleTraceTest                oracle                         I 34% complete
[02/17/2020 15:03:32:745 CST] 001 JdbcDatabaseContainer          waitUntilContainerStarted      I Container is started (JDBC URL: jdbc:oracle:thin:system/oracle@localhost:33890:xe)

I am guessing this is likely due to our wait strategy. We wait for a connection to become available then attempt to call SELECT 1 FROM DUAL. At 34% complete it seems like connection are able to be created but not used. Hence the error.

This may be related to #1292

@kiview
Copy link
Member

kiview commented Feb 18, 2020

@KyleAure thanks for investigating this.

In the light of #1292 and the fact that we have official images from Oracle, I would propose fixing the WaitStrategy to work with the new images (making it LogMessageWaitStrategy).

I can take care of this. But this would probably break backwards compatibility to the old (which is banned after all).

What do the others think? @rnorth @bsideup

@kiview
Copy link
Member

kiview commented Feb 18, 2020

Got kind of working waiting strategy, but the image takes 8 minutes to start. Does this even make sense in the context of TC?

    public OracleContainer(String dockerImageName) {
        super(dockerImageName);
        this.waitStrategy = new LogMessageWaitStrategy()
            .withRegEx("DATABASE IS READY TO USE!\\n")
            .withStartupTimeout(Duration.of(12, MINUTES));
    }

@KyleAure
Copy link
Contributor Author

Yeah I would be hesitant to break compatibility with oracleinanutshell/oracle-xe-11g and wnameless/docker-oracle-xe-11g since I am sure most people are using those right now.

But I think we should definitely document in our instructions how users can create their own images, and that we recommend building an image with a pre-built database (to alleviate startup time). If they are following those instructions they can set a password when building their image (in which case this PR is kind of moot).

Thoughts?

@kiview
Copy link
Member

kiview commented Feb 21, 2020

In the light of https://twitter.com/geraldvenzl/status/1230673245193539585?s=21 I would prefer to push for the official image. I would personally accept to break compatibility with the wnameless, since it is terribly out of date and a grey area after all.

The question is if we try to make the new self=built Oracle image good to use (with e.g. including container volume binding instructions), or if we should wait for the new official image and hope it has faster startup times.

@MeyerNils
Copy link

Regarding startup times I could imagine a completely different approach for Oracle - see #2369

@kiview
Copy link
Member

kiview commented Feb 25, 2020

@KyleAure
After diving a little bit into the internals of the official image I come to realize, that this ENV based approach only works when initializing a new database. This, however, is much to slow with the current official images (as we have already discovered).
For setting the password of an initialized image, we have to execute a script inside the running container (which we could support in theory).

In the light of these facts, do you think it is okay to close the current PR?

We currently plan to provide a testcontainer oracle-xe image on quay.io that contains an initialized database. I'd prefer if we continue from there.

The change for the SID we would incorporate however to be compatbile.

@KyleAure
Copy link
Contributor Author

Yes, I agree. Sorry for the runaround. I am glad to see oracle is officially releasing something! I think if anything we should document that using withPassword() (for oracle at least) should be used if you build an oracle image with a custom password... and that it won't actually change the password at runtime (like what happens with postgres)

@KyleAure KyleAure closed this Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OracleContainer needs further configuration OracleContainer allow custom password
3 participants