Olá,
O Oracle Client 21c já está disponível para download para as plataformas Linux.
Olá,
Abaixo é possível verificar que a autenticação falhou pelo fato de eu ter esquecido a senha do root para conectar no MySQL.
[root@linux ~]# mysql -uroot -psenha
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@linux ~]# systemctl stop mysqld
[root@linux ~]# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
[root@linux ~]# systemctl start mysqld
[root@linux ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
Database changed
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'senha';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@linux ~]# systemctl stop mysqld
[root@linux ~]# systemctl unset-environment MYSQLD_OPTS
[root@linux ~]# systemctl start mysqld
[root@linux ~]# mysql -uroot -psenha
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.28 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Olá,
mongoPrdSet:PRIMARY> use bd01
switched to db bd01
mongoPrdSet:PRIMARY> cols.forEach(function(col) {
... {
... vstat=db.getCollection(col).stats({ scale : 1024*1024 }) //Em MB
... print(vstat.ns + " - count: " + vstat.count + " - size MB: " + vstat.size + " - storage_size MB: "+vstat.storageSize)
... }
... });
bd01.col01 - count: 2507 - size MB: 139 - storage_size MB: 53
bd01.col02 - count: 44372 - size MB: 2852 - storage_size MB: 600
bd01.col03 - count: 118476 - size MB: 710 - storage_size MB: 155
bd01.col04 - count: 3936 - size MB: 49 - storage_size MB: 16
bd01.col05 - count: 1797 - size MB: 12 - storage_size MB: 3
bd01.col06 - count: 2728 - size MB: 24 - storage_size MB: 5
bd01.col07 - count: 9406 - size MB: 73 - storage_size MB: 14
bd01.col08 - count: 57 - size MB: 32 - storage_size MB: 3
bd01.col09 - count: 1760 - size MB: 62 - storage_size MB: 14
bd01.col10 - count: 1616 - size MB: 38 - storage_size MB: 11
bd01.col11 - count: 1501 - size MB: 64 - storage_size MB: 18
bd01.col12 - count: 42880 - size MB: 4783 - storage_size MB: 1045
bd01.col13 - count: 2652 - size MB: 98 - storage_size MB: 28
bd01.col14 - count: 211 - size MB: 5 - storage_size MB: 1
bd01.col15 - count: 8055 - size MB: 5 - storage_size MB: 1
bd01.col16 - count: 225 - size MB: 14 - storage_size MB: 18
bd01.col17 - count: 309 - size MB: 7 - storage_size MB: 2
bd01.col18 - count: 7579 - size MB: 37 - storage_size MB: 11
bd01.col19 - count: 27762 - size MB: 135 - storage_size MB: 28
bd01.col20 - count: 26807 - size MB: 72 - storage_size MB: 12
Olá,
Avg_fragmentation_in_percent Instrução corretiva
--------------------------------- --------------------------------------
> 5% e < = 30% ALTER INDEX REORGANIZE
> 30% ALTER INDEX REBUILD WITH (ONLINE = ON)
SELECT distinct (Index_Statement) FROM
(
SELECT CASE WHEN avg_fragmentation_in_percent BETWEEN 5 AND 30 THEN
'ALTER INDEX [' + name + '] ON ' + (SELECT TOP 1 TABLE_SCHEMA FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_NAME = OBJECT_NAME(b.[OBJECT_ID]) AND TABLE_TYPE = 'BASE TABLE')
+ '.[' + OBJECT_NAME(b.[OBJECT_ID]) + '] REORGANIZE;'
WHEN avg_fragmentation_in_percent > 30 THEN
'ALTER INDEX [' + name + '] ON ' + (SELECT TOP 1 TABLE_SCHEMA FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_NAME = OBJECT_NAME(b.[OBJECT_ID]) AND TABLE_TYPE = 'BASE TABLE')
+ '.[' + OBJECT_NAME(b.[OBJECT_ID]) + '] REBUILD;'
END AS Index_Statement
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS a
JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id
WHERE avg_fragmentation_in_percent > 5
AND index_type_desc <> 'HEAP'
AND page_count > 640) index_rebuild_reorganize
WHERE Index_Statement Is NOT NULL;
Index_Statement
----------------------------------------------------
ALTER INDEX [IDX_TBL_08] ON dbo.[TBL_08] REORGANIZE;
ALTER INDEX [IDX_TBL_07] ON dbo.[TBL_07] REBUILD;
ALTER INDEX [IDX_TBL_06] ON dbo.[TBL_06] REORGANIZE;
ALTER INDEX [IDX_TBL_05] ON dbo.[TBL_05] REBUILD;
ALTER INDEX [IDX_TBL_04] ON dbo.[TBL_04] REORGANIZE;
ALTER INDEX [IDX_TBL_03] ON dbo.[TBL_03] REBUILD;
ALTER INDEX [IDX_TBL_02] ON dbo.[TBL_02] REORGANIZE;
ALTER INDEX [IDX_TBL_01] ON dbo.[TBL_01] REORGANIZE;
ALTER INDEX [PKI_TBL_08] ON dbo.[TBL_08] REORGANIZE;
ALTER INDEX [PKI_TBL_09] ON dbo.[TBL_09] REORGANIZE;
(10 rows affected)
Completion time: 2020-08-07T16:24:33.6867313-03:00
mongoSet:PRIMARY> db.currentOp({"secs_running": {$gte: 1}})
{
"inprog" : [
{
"desc" : "conn9145756",
"threadId" : "139937773053696",
"connectionId" : 9145756,
"client" : "192.168.1.10:34456",
"active" : true,
"opid" : 425355448,
"secs_running" : 3,
"microsecs_running" : NumberLong(7491051),
"op" : "query",
"ns" : "bd01.customer",
"query" : {
"find" : "customer",
"filter" : {
"_id" : ObjectId("0000001")
},
"batchSize" : 300
},
"numYields" : 0,
"locks" : {
"Global" : "r",
"Database" : "r",
"Collection" : "r"
},
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(2)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(1)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(1)
}
}
}
},
{
"desc" : "ReplBatcher",
"threadId" : "139937860310784",
"active" : true,
"opid" : 10,
"secs_running" : 1300926,
"microsecs_running" : NumberLong("22775762702217"),
"op" : "none",
"ns" : "local.oplog.rs",
"query" : {
},
"numYields" : 0,
"locks" : {
},
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(2)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(1)
}
},
"oplog" : {
"acquireCount" : {
"r" : NumberLong(1)
}
}
}
},
{
"desc" : "rsSync",
"threadId" : "139938179233536",
"active" : true,
"opid" : 9,
"secs_running" : 1300926,
"microsecs_running" : NumberLong("22775762702158"),
"op" : "none",
"ns" : "local.oplog.rs",
"query" : {
},
"numYields" : 0,
"locks" : {
},
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(24704),
"w" : NumberLong(18515),
"R" : NumberLong(6172),
"W" : NumberLong(6172)
},
"acquireWaitCount" : {
"W" : NumberLong(974)
},
"timeAcquiringMicros" : {
"W" : NumberLong(19504794)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(8),
"w" : NumberLong(1),
"W" : NumberLong(18514)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(7)
}
},
"Metadata" : {
"acquireCount" : {
"w" : NumberLong(1)
}
},
"oplog" : {
"acquireCount" : {
"r" : NumberLong(1),
"w" : NumberLong(1)
}
}
}
},
{
"desc" : "WT RecordStoreThread: local.oplog.rs",
"threadId" : "139938314262272",
"active" : true,
"opid" : 424925952,
"secs_running" : 920,
"microsecs_running" : NumberLong(920757610),
"op" : "none",
"ns" : "local.oplog.rs",
"query" : {
},
"numYields" : 0,
"locks" : {
},
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(1),
"w" : NumberLong(1)
}
},
"Database" : {
"acquireCount" : {
"w" : NumberLong(1)
}
},
"oplog" : {
"acquireCount" : {
"w" : NumberLong(1)
}
}
}
}
],
"ok" : 1
}
mongoSet:PRIMARY> db.currentOp({"active" : true,"secs_running" : { "$gt" : 0 },"ns" : {$ne : "local.oplog.rs"}})
{
"inprog" : [
{
"desc" : "conn1371708",
"threadId" : "140655653025536",
"connectionId" : 1371708,
"client" : "172.31.80.121:51282",
"active" : true,
"opid" : 2036637847,
"secs_running" : 1,
"microsecs_running" : NumberLong(1082772),
"op" : "query",
"ns" : "bd01.product",
"query" : {
"$msg" : "query not recording (too large)"
},
"numYields" : 58,
"locks" : {
"Global" : "r",
"Database" : "r"
},
"waitingForLock" : true,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(118)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(59)
},
"acquireWaitCount" : {
"r" : NumberLong(58)
},
"timeAcquiringMicros" : {
"r" : NumberLong(935638)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(58)
}
}
}
},
{
"desc" : "conn980301",
"threadId" : "140655740397312",
"connectionId" : 980301,
"client" : "192.168.1.10:55542",
"active" : true,
"opid" : 2036637676,
"secs_running" : 1,
"microsecs_running" : NumberLong(1310312),
"op" : "query",
"ns" : "bd01.product",
"query" : {
"$msg" : "query not recording (too large)"
},
"numYields" : 74,
"locks" : {
"Global" : "r",
"Database" : "r",
"Collection" : "r"
},
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(150)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(75)
},
"acquireWaitCount" : {
"r" : NumberLong(71)
},
"timeAcquiringMicros" : {
"r" : NumberLong(1140143)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(75)
}
}
}
},
{
"desc" : "conn980023",
"threadId" : "140655865579264",
"connectionId" : 980023,
"client" : "192.168.1.10:55132",
"active" : true,
"opid" : 2036637864,
"secs_running" : 1,
"microsecs_running" : NumberLong(1071661),
"op" : "query",
"ns" : "bd01.product",
"query" : {
"$msg" : "query not recording (too large)"
},
"numYields" : 63,
"locks" : {
"Global" : "r",
"Database" : "r"
},
"waitingForLock" : true,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(128)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(64)
},
"acquireWaitCount" : {
"r" : NumberLong(60)
},
"timeAcquiringMicros" : {
"r" : NumberLong(910226)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(63)
}
}
}
},
{
"desc" : "conn980300",
"threadId" : "140655781451520",
"connectionId" : 980300,
"client" : "192.168.1.10:44064",
"active" : true,
"opid" : 2036637740,
"secs_running" : 1,
"microsecs_running" : NumberLong(1200164),
"op" : "query",
"ns" : "bd01.product",
"query" : {
"$msg" : "query not recording (too large)"
},
"numYields" : 67,
"locks" : {
"Global" : "r",
"Database" : "r"
},
"waitingForLock" : true,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(136)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(68)
},
"acquireWaitCount" : {
"r" : NumberLong(64)
},
"timeAcquiringMicros" : {
"r" : NumberLong(1015696)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(67)
}
}
}
}
],
"ok" : 1
}
[root@linux /]# sqlcmd -S localhost -U SA -Pminhasenha
1> DECLARE @test varchar(20), @key varchar(100)
2> if charindex('\',@@servername,0) <>0
3> begin
4> set @key = 'SOFTWARE\MICROSOFT\Microsoft SQL Server\'+@@servicename+'\MSSQLServer\Supersocketnetlib\TCP'
5> end
6> else
7> begin
8> set @key = 'SOFTWARE\MICROSOFT\MSSQLServer\MSSQLServer\Supersocketnetlib\TCP'
9> end
10> EXEC master..xp_regread @rootkey='HKEY_LOCAL_MACHINE',@key=@key,@value_name='Tcpport',@value=@test OUTPUT
11> SELECT 'Server Name: '+@@servername + ' Port Number:'+convert(varchar(10),@test) port;
12> GO
port
-----------------------------------
Server Name: linux Port Number:1433
(1 rows affected)
[mongodb ~]$ mongo --host localhost --port 27017
MongoDB shell version v4.0.17
connecting to: mongodb://localhost:27017/?authSource=admin&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("41d40407-eb0e-4e45-b9b9-7882d4a30fcc") }
MongoDB server version: 4.0.17
> db.getProfilingStatus()
{ "was" : 0, "slowms" : 100 }
> db.setProfilingLevel(0,500)
{ "was" : 0, "slowms" : 100, "ok" : 1 }
> db.getProfilingStatus()
{ "was" : 0, "slowms" : 500 }
db.createCollection( "log_events", { capped: true, size: 5242880 } )
db.createCollection("log_events", { capped : true, size : 5242880, max : 100000 } )
Command failed with error 10003: 'Cannot change the size of a document in a capped collection: 608 != 1601' on server.
The full response is {"ok": 0.0, "errmsg": "Cannot change the size of a document in a capped collection: 608 != 1601", "code": 10003}
db.runCommand( { convertToCapped: "log_events", size: 5242880 } )
> use bd01
switched to db bd01
> db.getCollection("log_events").insert({"createdAt": new Date(),"logEvent": 1,"logMessage": "Successo!"})
WriteResult({ "nInserted" : 1 })
> db.getCollection("log_events").insert({"createdAt": new Date(),"logEvent": 1,"logMessage": "Successo!"})
WriteResult({ "nInserted" : 1 })
> db.getCollection("log_events").insert({"createdAt": new Date(),"logEvent": 1,"logMessage": "Successo!"})
WriteResult({ "nInserted" : 1 })
> db.getCollection("log_events").createIndex({"createdAt": 1}, {expireAfterSeconds: 60})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
> db.getCollection("log_events").find().sort({"createdAt": -1})
{ "_id" : ObjectId("5e6648604c6b3ab44b007757"), "createdAt" : ISODate("2020-03-09T13:45:04.164Z"), "logEvent" : 1, "logMessage" : "Successo!" }
{ "_id" : ObjectId("5e6648254c6b3ab44b007756"), "createdAt" : ISODate("2020-03-09T13:44:05.380Z"), "logEvent" : 1, "logMessage" : "Successo!" }
{ "_id" : ObjectId("5e6647e64c6b3ab44b007755"), "createdAt" : ISODate("2020-03-09T13:43:02.564Z"), "logEvent" : 1, "logMessage" : "Successo!" }
> db.getCollection("log_events").find().sort({"createdAt": -1})
{ "_id" : ObjectId("5e6648604c6b3ab44b007757"), "createdAt" : ISODate("2020-03-09T13:45:04.164Z"), "logEvent" : 1, "logMessage" : "Successo!" }
> db.getCollection("log_events").createIndex({"createdAt": 1}, {expireAfterSeconds: 2592000})
[timestamp] [severity] [component] [context] [message]
2020-02-07T13:06:29.731+0000 [initandlisten] connection accepted from 127.0.0.1:27017 #1000 (13 connections now open)
2020-02-07T13:06:35.770+0000 [conn1000] end connection 127.0.0.1:27017 (12 connections now open)
2020-02-07T13:28:32.450-0500 I NETWORK [initandlisten] waiting for connections on port 27017
Timestamp: 2020-02-07T13:28:32.450-0500
Severity: I
Component: NETWORK
Context: [initandlisten]
Message: waiting for connections on port 27017
2020-02-07T13:19:46-0300 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
Resolução: Criar o usuário Admin no banco de dados Admin
2020-02-07T13:20:46-0300 E COMMAND [initandlisten] ** ERROR: getMore command failed. Cursor not found
Resolução: Remover a opção de timeout do cursor db.collection.find(query).noCursorTimeout() ou aumente o limite de tempo db.adminCommand( { setParameter: 1, cursorTimeoutMillis: 600000 } )
2020-02-07T13:21:46-0300 E INDEX [initandlisten] ** ERROR:E11000 duplicate key error index: db01.customer.$cod.id_1 dup key: { : null }
Resolução: Se refere a violação de uma unique constraint. Tente inserir um documento com um valor de chave diferente para o campo em questão
2020-02-07T13:22:46-0300 E NETWORK [initandlisten] ** ERROR:Timed out connecting to localhost:27017.
Resolução: A latência entre o driver cliente e o servidor é muito grande. Aumente o valor da opção connectionTimeout na string de conexão.
2020-02-07T13:23:46-0300 E WRITE [initandlisten] ** ERROR: A write operation resulted in an error. E11000 duplicate key error index: db01.customer.$_id_ dup key: { : 0 }
Resolução: Remova o documento _id duplicado ou insira um documento com outro _id
2020-02-07T13:24:46-0300 E NETWORK [initandlisten] ** ERROR: No connection could be made because the target machine actively refused it 127.0.0.1:27017 at System.Net.Sockets.Socket.EndConnect
Resolução: O servidor não estpa rodando na porta padrão 27017 ou utilize uma porta diferente.
2020-02-07T13:25.505-0300 I INDEX [conn4904867] add index fails, too many indexes for db01.customer key:{ cus_status: 1 }
Resolução: Cada collection no MongoDB pode ter no máximo 64 índices. Remova índices que não estão sendo utilizados.